Cập nhật 11/08/2020
Các hàm Hooks (Actions & Filters) trong theme Flatsome thần thánh để thêm các code tùy chỉnh của mình vào đúng vị trí nhé!
Theme Hooks (Actions & Filters)
Table of Contents
Actions
- flatsome_absolute_footer_primary
- flatsome_absolute_footer_secondary
- flatsome_account_links
- flatsome_after_404
- flatsome_after_account_user
- flatsome_after_blog
- flatsome_after_body_open
- flatsome_after_breadcrumb
- flatsome_after_footer
- flatsome_after_header
- flatsome_after_header_bottom
- flatsome_after_page
- flatsome_after_page_content
- flatsome_after_product_images
- flatsome_after_product_page
- flatsome_before_404
- flatsome_before_blog
- flatsome_before_breadcrumb
- flatsome_before_comments
- flatsome_before_footer
- flatsome_before_header
- flatsome_before_page
- flatsome_before_page_content
- flatsome_before_product_images
- flatsome_before_product_page
- flatsome_before_product_sidebar
- flatsome_before_single_product_custom
- flatsome_blog_post_after
- flatsome_blog_post_before
- flatsome_breadcrumb
- flatsome_cart_sidebar
- flatsome_category_title
- flatsome_category_title_alt
- flatsome_footer
- flatsome_header_background
- flatsome_header_elements
- flatsome_header_wrapper
- flatsome_portfolio_title_after
- flatsome_portfolio_title_left
- flatsome_portfolio_title_right
- flatsome_product_box_actions
- flatsome_product_box_after
- flatsome_product_box_tools_bottom
- flatsome_product_box_tools_top
- flatsome_product_image_tools_bottom
- flatsome_product_image_tools_top
- flatsome_product_title
- flatsome_product_title_tools
- flatsome_products_after
- flatsome_products_before
- flatsome_sale_flash
- flatsome_woocommerce_shop_loop_images
52 actions
Filters
- flatsome_ajax_search_function
- flatsome_ajax_search_post_type
- flatsome_ajax_search_products_by_sku_search_query
- flatsome_ajax_search_products_by_tag_search_query
- flatsome_ajax_search_products_search_query
- flatsome_ajax_search_query
- flatsome_attachment_size
- flatsome_before_body_close_priority
- flatsome_custom_product_single_product_hooks
- flatsome_disable_mini_cart
- flatsome_dummy_text
- flatsome_header_class
- flatsome_header_element
- flatsome_header_title_class
- flatsome_infinite_scroll_params
- flatsome_lightbox_close_btn_inside
- flatsome_lightbox_close_button
- flatsome_main_class
- flatsome_payment_icons
- flatsome_product_block
- flatsome_product_block_primary_term_id
- flatsome_product_block_product_terms_args
- flatsome_product_labels
- flatsome_sidebar_class
- flatsome_text_formats
- flatsome_viewport_meta
- flatsome_woocommerce_get_alt_product_thumbnail
- flatsome_woocommerce_shop_loop_category
- flatsome_wpseo_breadcrumb_remove_last
29 filters
flatsome_absolute_footer_primary
Type: action
Files:
- template-parts/footer/footer-absolute.php
flatsome_absolute_footer_secondary
Type: action
Hooked:
- flatsome_footer_payment_icons – 10
Files:
- template-parts/footer/footer-absolute.php
flatsome_account_links
Type: action
Hooked:
- flatsome_wishlist_account_item – 10
Files:
- woocommerce/myaccount/dashboard-links.php
- woocommerce/myaccount/account-links.php
flatsome_after_404
Type: action
Files:
- 404.php
flatsome_after_account_user
Type: action
Files:
- woocommerce/myaccount/account-user.php
flatsome_after_blog
Type: action
Files:
- template-parts/posts/layout-left-sidebar.php
- template-parts/posts/layout-right-sidebar.php
- template-parts/posts/layout.php
flatsome_after_body_open
Type: action
Hooked:
- flatsome_after_body_open – 10
Files:
- header.php
flatsome_after_breadcrumb
Type: action
Files:
- woocommerce/global/breadcrumb.php
- inc/integrations/wp-seo/class-wp-seo.php
flatsome_after_footer
Type: action
Hooked:
- flatsome_html_after_footer – 10
Files:
- template-parts/footer/footer.php
flatsome_after_header
Type: action
Hooked:
- flatsome_html_after_header – 1
- flatsome_custom_blog_header – 10
- flatsome_single_page_header – 10
- flatsome_category_header – 10
- flatsome_product_header – 10
- flatsome_woocommerce_add_notice – 100
Files:
- single-blocks.php
- page-blank-landingpage.php
- header.php
flatsome_after_header_bottom
Type: action
Files:
- template-parts/header/header-bottom.php
flatsome_after_page
Type: action
Hooked:
- flatsome_wp_link_pages – 10
- flatsome_page_passord_required_bottom – 99
Files:
- page-blank-sub-nav-vertical.php
- page-blank-title-center.php
- page-transparent-header-light.php
- page-right-sidebar.php
- page-single-page-nav.php
- single-blocks.php
- page-blank-landingpage.php
- page-blank.php
- page-my-account.php
- page-left-sidebar.php
- page-transparent-header.php
- page.php
- page-single-page-nav-transparent.php
- page-header-on-scroll.php
- page-single-page-nav-transparent-light.php
flatsome_after_page_content
Type: action
Files:
- page.php
flatsome_after_product_images
Type: action
Files:
- woocommerce/single-product/product-image-stacked.php
- woocommerce/single-product/product-image-wide.php
- woocommerce/single-product/product-image.php
- woocommerce/single-product/product-image-vertical.php
flatsome_after_product_page
Type: action
Hooked:
- flatsome_product_bottom_content – 10
Files:
- woocommerce/single-product.php
flatsome_before_404
Type: action
Files:
- 404.php
flatsome_before_blog
Type: action
Hooked:
- flatsome_archive_title – 15
Files:
- template-parts/posts/layout-left-sidebar.php
- template-parts/posts/layout-right-sidebar.php
- template-parts/posts/layout.php
flatsome_before_breadcrumb
Type: action
Files:
- woocommerce/global/breadcrumb.php
- inc/integrations/wp-seo/class-wp-seo.php
flatsome_before_comments
Type: action
Hooked:
- flatsome_before_blog_comments – 10
Files:
- comments.php
flatsome_before_footer
Type: action
Hooked:
- flatsome_html_before_footer – 10
Files:
- template-parts/footer/footer.php
flatsome_before_header
Type: action
Files:
- header.php
flatsome_before_page
Type: action
Hooked:
- flatsome_page_passord_required_top – -99
- flatsome_page_top_excerpt – 20
Files:
- page-blank-sub-nav-vertical.php
- page-blank-title-center.php
- page-transparent-header-light.php
- page-right-sidebar.php
- page-single-page-nav.php
- single-blocks.php
- page-blank-landingpage.php
- page-blank.php
- page-my-account.php
- page-left-sidebar.php
- page-transparent-header.php
- page.php
- page-single-page-nav-transparent.php
- page-header-on-scroll.php
- page-single-page-nav-transparent-light.php
flatsome_before_page_content
Type: action
Files:
- page.php
flatsome_before_product_images
Type: action
Files:
- woocommerce/single-product/product-image-stacked.php
- woocommerce/single-product/product-image-wide.php
- woocommerce/single-product/product-image.php
- woocommerce/single-product/product-image-vertical.php
flatsome_before_product_page
Type: action
Hooked:
- flatsome_product_top_content – 10
Files:
- woocommerce/single-product.php
flatsome_before_product_sidebar
Type: action
Hooked:
- flatsome_product_nav_sidebar – 0
- flatsome_product_upsell_sidebar – 1
Files:
- woocommerce/content-single-product-custom.php
- woocommerce/single-product/layouts/product-right-sidebar-full.php
- woocommerce/single-product/layouts/product-left-sidebar-small.php
- woocommerce/single-product/layouts/product.php
- woocommerce/single-product/layouts/product-left-sidebar.php
- woocommerce/single-product/layouts/product-stacked-right.php
- woocommerce/single-product/layouts/product-right-sidebar.php
- woocommerce/single-product/layouts/product-no-sidebar.php
- woocommerce/single-product/layouts/product-left-sidebar-full.php
flatsome_before_single_product_custom
Type: action
Hooked:
- flatsome_single_product_custom_structured_data – 10
Files:
- woocommerce/content-single-product-custom.php
Since: 3.12.0
flatsome_blog_post_after
Type: action
Files:
- inc/shortcodes/blog_posts.php
flatsome_blog_post_before
Type: action
Files:
- inc/shortcodes/blog_posts.php
flatsome_breadcrumb
Type: action
Hooked:
- woocommerce_breadcrumb – 20
Files:
- inc/functions/fl-template-functions.php
flatsome_cart_sidebar
Type: action
Hooked:
- flatsome_html_cart_sidebar – 10
Files:
- woocommerce/cart/cart.php
- template-parts/header/partials/element-cart-mobile.php
- template-parts/header/partials/element-cart.php
flatsome_category_title
Type: action
Hooked:
- flatsome_category_title – 1
- flatsome_shop_loop_tools_breadcrumbs – 10
- flatsome_add_category_filter_button – 20
Files:
- woocommerce/layouts/headers/category-title-featured.php
- woocommerce/layouts/headers/category-title-featured-center.php
- woocommerce/layouts/headers/category-title.php
flatsome_category_title_alt
Type: action
Hooked:
- wc_setup_loop – 10
- woocommerce_result_count – 20
- woocommerce_catalog_ordering – 30
Files:
- woocommerce/layouts/headers/category-title-featured.php
- woocommerce/layouts/headers/category-title-featured-center.php
- woocommerce/layouts/headers/category-title.php
Doc: https://docs.uxthemes.com/article/350-woocommerce-shop-page-result-count-and-ordering-dropdown
flatsome_footer
Type: action
Hooked:
- flatsome_page_footer – 10
- flatsome_go_to_top – 10
Files:
- footer.php
flatsome_header_background
Type: action
Hooked:
- flatsome_add_header_backgrounds – 10
Files:
- template-parts/header/header-wrapper.php
flatsome_header_elements
Type: action
Files:
- inc/structure/structure-header.php
flatsome_header_wrapper
Type: action
Files:
- template-parts/header/header-wrapper.php
flatsome_portfolio_title_after
Type: action
Files:
- template-parts/portfolio/archive-portfolio-title-featured.php
- template-parts/portfolio/portfolio-title-featured.php
flatsome_portfolio_title_left
Type: action
Files:
- template-parts/portfolio/archive-portfolio-title-featured.php
flatsome_portfolio_title_right
Type: action
Files:
- template-parts/portfolio/archive-portfolio-title-featured.php
flatsome_product_box_actions
Type: action
Hooked:
- flatsome_product_box_actions_add_to_cart – 1
- flatsome_lightbox_button – 50
Files:
- woocommerce/content-product.php
- inc/shortcodes/ux_products.php
- inc/shortcodes/ux_products.php
flatsome_product_box_after
Type: action
Hooked:
- flatsome_woocommerce_shop_loop_excerpt – 20
- flatsome_woocommerce_shop_loop_button – 100
Files:
- woocommerce/content-product.php
- inc/shortcodes/ux_products.php
flatsome_product_box_tools_bottom
Type: action
Files:
- woocommerce/content-product.php
flatsome_product_box_tools_top
Type: action
Hooked:
- flatsome_product_wishlist_button – 2
Files:
- woocommerce/content-product.php
- inc/shortcodes/ux_products.php
flatsome_product_image_tools_bottom
Type: action
Hooked:
- flatsome_product_video_button – 1
- flatsome_product_lightbox_button – 2
Files:
- woocommerce/single-product/product-image-wide.php
- woocommerce/single-product/product-image.php
- woocommerce/single-product/product-image-vertical.php
flatsome_product_image_tools_top
Type: action
Hooked:
- flatsome_product_wishlist_button – 2
Files:
- woocommerce/single-product/product-image-default.php
- woocommerce/single-product/product-image-stacked.php
- woocommerce/single-product/product-image-wide.php
- woocommerce/single-product/product-image.php
- woocommerce/single-product/product-image-vertical.php
flatsome_product_title
Type: action
Hooked:
- flatsome_product_page_title – 10
- flatsome_product_page_breadcrumbs – 20
Files:
- woocommerce/single-product/headers/header-product-featured-center.php
- woocommerce/single-product/headers/header-product-top.php
- woocommerce/single-product/headers/header-product-featured.php
flatsome_product_title_tools
Type: action
Hooked:
- flatsome_product_title_next_prev – 20
Files:
- woocommerce/single-product/headers/header-product-featured-center.php
- woocommerce/single-product/headers/header-product-top.php
- woocommerce/single-product/headers/header-product-featured.php
flatsome_products_after
Type: action
Hooked:
- flatsome_products_footer_content – 10
Files:
- woocommerce/layouts/category.php
- woocommerce/layouts/category-none.php
- woocommerce/layouts/category-right-sidebar.php
- woocommerce/layouts/category-off-canvas.php
flatsome_products_before
Type: action
Files:
- woocommerce/layouts/category-none.php
- woocommerce/layouts/category-right-sidebar.php
- woocommerce/layouts/category-off-canvas.php
flatsome_sale_flash
Type: action
Hooked:
- woocommerce_show_product_sale_flash – 10
Files:
- woocommerce/single-product/product-image-default.php
- woocommerce/single-product/product-image-stacked.php
- woocommerce/single-product/product-image-wide.php
- woocommerce/single-product/product-image.php
- woocommerce/single-product/product-image-vertical.php
flatsome_woocommerce_shop_loop_images
Type: action
Hooked:
- woocommerce_template_loop_product_thumbnail – 10
- flatsome_woocommerce_get_alt_product_thumbnail – 11
Files:
- woocommerce/content-product.php
flatsome_ajax_search_function
Type: filter
Files:
- inc/extensions/flatsome-live-search/flatsome-live-search.php
- inc/extensions/flatsome-live-search/flatsome-live-search.php
flatsome_ajax_search_post_type
Type: filter
Files:
- inc/extensions/flatsome-live-search/flatsome-live-search.php
flatsome_ajax_search_products_by_sku_search_query
Type: filter
Files:
- inc/extensions/flatsome-live-search/flatsome-live-search.php
flatsome_ajax_search_products_by_tag_search_query
Type: filter
Files:
- inc/extensions/flatsome-live-search/flatsome-live-search.php
flatsome_ajax_search_products_search_query
Type: filter
Files:
- inc/extensions/flatsome-live-search/flatsome-live-search.php
flatsome_ajax_search_query
Type: filter
Files:
- inc/extensions/flatsome-live-search/flatsome-live-search.php
- inc/extensions/flatsome-live-search/flatsome-live-search.php
flatsome_attachment_size
Type: filter
Files:
- image.php
flatsome_before_body_close_priority
Type: filter
Files:
- inc/structure/structure-footer.php
flatsome_custom_product_single_product_hooks
Type: filter
Files:
- inc/builder/shortcodes/custom-product.php
flatsome_disable_mini_cart
Type: filter
Files:
- template-parts/header/partials/element-cart-mobile.php
- template-parts/header/partials/element-cart.php
flatsome_dummy_text
Type: filter
Files:
- inc/helpers/helpers-frontend.php
flatsome_header_class
Type: filter
Files:
- inc/structure/structure-header.php
flatsome_header_element
Type: filter
Files:
- inc/admin/options/helpers/options-helpers.php
flatsome_header_title_class
Type: filter
Files:
- inc/structure/structure-header.php
flatsome_infinite_scroll_params
Type: filter
Files:
- inc/extensions/flatsome-infinite-scroll/class-flatsome-infinite-scroll.php
Since: 3.6.2
Doc: https://docs.uxthemes.com/article/316-infinite-scroll-disable-history
flatsome_lightbox_close_btn_inside
Type: filter
Files:
- inc/functions/function-setup.php
Since: 3.9.0
Doc: https://docs.uxthemes.com/article/378-lightbox-close-button
flatsome_lightbox_close_button
Type: filter
Files:
- inc/functions/function-setup.php
Since: 3.9.0
Doc: https://docs.uxthemes.com/article/378-lightbox-close-button
flatsome_main_class
Type: filter
Files:
- inc/structure/structure-header.php
flatsome_payment_icons
Type: filter
Files:
- inc/woocommerce/structure-wc-global.php
Since: 3.9.0
Doc: https://docs.uxthemes.com/article/351-paymenticons
flatsome_product_block
Type: filter
Files:
- inc/helpers/helpers-woocommerce.php
Since: 3.12.0
Doc: https://docs.uxthemes.com/article/389-custom-product-page
flatsome_product_block_primary_term_id
Type: filter
Files:
- inc/helpers/helpers-woocommerce.php
Since: 3.12.0
flatsome_product_block_product_terms_args
Type: filter
Files:
- inc/helpers/helpers-woocommerce.php
Since: 3.12.0
flatsome_product_labels
Type: filter
Files:
- woocommerce/single-product/sale-flash.php
- woocommerce/loop/sale-flash.php
flatsome_sidebar_class
Type: filter
Files:
- inc/structure/structure-sidebars.php
flatsome_text_formats
Type: filter
Files:
- inc/structure/structure-admin.php
flatsome_viewport_meta
Type: filter
Files:
- inc/structure/structure-header.php
Since: 3.9.0
flatsome_woocommerce_get_alt_product_thumbnail
Type: filter
Files:
- inc/woocommerce/structure-wc-product-box.php
flatsome_woocommerce_shop_loop_category
Type: filter
Files:
- inc/woocommerce/structure-wc-product-box.php
flatsome_wpseo_breadcrumb_remove_last
Type: filter
Files:
- inc/integrations/wp-seo/class-wp-seo.php
Version: 3.12.1
Ví dụ:
1 2 3 4 |
function add_text_flatsome_before_product_page(){ echo '<div>Codfe</div>'; } add_action('flatsome_after_product_page','add_text_flatsome_before_product_page'); |