Bài viết này mình sẽ hướng dẫn các anh em có thể show toàn bộ các hook của Flatsome cũng như vị trí cụ thể của nó để anh em có thể thêm vào bất kì thứ gì mình muốn nhé, ở bài này mình chỉ show các action thôi nhé, filter thì để bài sau mình sẽ hướng dẫn.

Hướng dẫn cách show toàn bộ các hook có trong Theme Flatsome
Hướng dẫn cách show toàn bộ các hook có trong Theme Flatsome

Mọi người chỉ cần sử dụng code sau là có thể show ra được các hook action cũng như tên gọi của nó. Hiện Flatsome hỗ trợ 52 action.

Show tất cả các hook của Flatsome có trong theme

add_action('flatsome_woocommerce_shop_loop_images','wsudevshowhook');
add_action('flatsome_sale_flash','wsudevshowhook');
add_action('flatsome_products_before','wsudevshowhook');
add_action('flatsome_products_after','wsudevshowhook');
add_action('flatsome_product_title_tools','wsudevshowhook');
add_action('flatsome_product_title','wsudevshowhook');
add_action('flatsome_product_image_tools_top','wsudevshowhook');
add_action('flatsome_product_image_tools_bottom','wsudevshowhook');
add_action('flatsome_product_box_tools_top','wsudevshowhook');
add_action('flatsome_product_box_tools_bottom','wsudevshowhook');
add_action('flatsome_product_box_after','wsudevshowhook');
add_action('flatsome_product_box_actions','wsudevshowhook');
add_action('flatsome_portfolio_title_right','wsudevshowhook');
add_action('flatsome_portfolio_title_left','wsudevshowhook');
add_action('flatsome_portfolio_title_after','wsudevshowhook');
add_action('flatsome_woocommerce_shop_loop_images','wsudevshowhook');
add_action('flatsome_sale_flash','wsudevshowhook');
add_action('flatsome_header_wrapper','wsudevshowhook');
add_action('flatsome_header_elements','wsudevshowhook');
add_action('flatsome_header_background','wsudevshowhook');
add_action('flatsome_footer','wsudevshowhook');
add_action('flatsome_category_title_alt','wsudevshowhook');
add_action('flatsome_category_title','wsudevshowhook');
add_action('flatsome_cart_sidebar','wsudevshowhook');
add_action('flatsome_breadcrumb','wsudevshowhook');
add_action('flatsome_blog_post_before','wsudevshowhook');
add_action('flatsome_blog_post_after','wsudevshowhook');
add_action('flatsome_before_single_product_custom','wsudevshowhook');
add_action('flatsome_before_product_sidebar','wsudevshowhook');
add_action('flatsome_before_product_page','wsudevshowhook');
add_action('flatsome_woocommerce_shop_loop_images','wsudevshowhook');
add_action('flatsome_sale_flash','wsudevshowhook');
add_action('flatsome_before_product_images','wsudevshowhook');
add_action('flatsome_before_page_content','wsudevshowhook');
add_action('flatsome_before_page','wsudevshowhook');
add_action('flatsome_before_header','wsudevshowhook');
add_action('flatsome_before_footer','wsudevshowhook');
add_action('flatsome_before_comments','wsudevshowhook');
add_action('flatsome_before_breadcrumb','wsudevshowhook');
add_action('flatsome_before_blog','wsudevshowhook');
add_action('flatsome_before_404','wsudevshowhook');
add_action('flatsome_after_product_page','wsudevshowhook');
add_action('flatsome_after_product_images','wsudevshowhook');
add_action('flatsome_absolute_footer_primary','wsudevshowhook');
add_action('flatsome_absolute_footer_secondary','wsudevshowhook');
add_action('flatsome_account_links','wsudevshowhook');
add_action('flatsome_after_404','wsudevshowhook');
add_action('flatsome_after_account_user','wsudevshowhook');
add_action('flatsome_after_blog','wsudevshowhook');
add_action('flatsome_after_body_open','wsudevshowhook');
add_action('flatsome_after_breadcrumb','wsudevshowhook');
add_action('flatsome_after_footer','wsudevshowhook');
add_action('flatsome_after_page_content','wsudevshowhook');
add_action('flatsome_after_page','wsudevshowhook');
add_action('flatsome_after_header_bottom','wsudevshowhook');
add_action('flatsome_after_header','wsudevshowhook');
function wsudevshowhook(){
echo current_filter().'</br>';
}

Như vậy là xong, các bạn có thể kiểm tra thử site của mình xem các hook này đã hiển thị chưa nhé.
Nguồn: pttuan410

Đánh giá mức độ hài lòng của bạn về bài viết
Xin Chào! Bạn thấy nội dung này thế nào?
Việt Blue

Quốc Việt hiện đang công tác tại WebStartup ở vị trí bảo vệ và kiêm là quản trị viên, thích chia sẽ và chia sẽ! Phương châm sống "Cho đi sẽ còn lại mãi mãi".