Một số thủ thuật cho Flatsome theme

Một số thủ thuật cho Flatsome theme

Ẩn thông báo đăng ký flatsome

add_action( 'init', 'hide_notice' );
function hide_notice() {
   remove_action( 'admin_notices', 'flatsome_maintenance_admin_notice' );
}

Thêm custom post type khi live search

function custom_ajax_search_post_types($post_types) {
    $post_types[] = 'app';
    $post_types[] = 'post';
    return $post_types;
}
add_filter('flatsome_ajax_search_post_type', 'custom_ajax_search_post_types');

Trong có custom post type là postapp

Ghi đè thư mục inc/shortcodes

Sao chép 1 shortcode nào đó trong theme cha, ở đây ví dụ là flatsome/inc/shortcodes/ux_product_categories.php sang [child-theme]/inc/shortcodes/ux_product_categories.php

Đổi tên function

ux_product_categories

sang

child_ux_product_categories

, đồng thời cho cả shortcode bên dưới

add_shortcode("ux_product_categories", "ux_product_categories");
add_shortcode("ux_product_categories_grid", "ux_product_categories");

thành

add_shortcode("ux_product_categories", "child_ux_product_categories");
add_shortcode("ux_product_categories_grid", "child_ux_product_categories");

Cuối cùng thêm hàm này vào functions.php trong child-theme

function custom_override_flatsome_shortcodes() {
    require get_stylesheet_directory() . '/inc/shortcodes/product_categories.php';
}
add_action('wp_loaded', 'custom_override_flatsome_shortcodes', 10);
Theo dõi
Thông báo của
guest
0 Comments
Phản hồi nội tuyến
Xem tất cả bình luận
0
Rất thích suy nghĩ của bạn, hãy bình luận.x