对于所有与woocommerce相关的产品,在每个钩子之前,phpdoc块中会有一个@hooked
标签。如果没有@hooked
标签,那个钩子只是一个可能在未来使用的保留钩子。
让我们来看看storefront_header hook:
/**
* Functions hooked into storefront_header action
*
* @hooked storefront_skip_links - 0
* @hooked storefront_social_icons - 10
* @hooked storefront_site_branding - 20
* @hooked storefront_secondary_navigation - 30
* @hooked storefront_product_search - 40
* @hooked storefront_primary_navigation_wrapper - 42
* @hooked storefront_primary_navigation - 50
* @hooked storefront_header_cart - 60
* @hooked storefront_primary_navigation_wrapper_close - 68
*/
do_action('storefront_header');
后@hooked
标签是当动作被触发执行函数的函数名称和优先级。较低的数字对应于较早的执行。
挂钩钩的大部分功能位于storefront-template-functions.php
的内部并添加到storefront-template-hooks.php
的内部。
您可以在主题文件夹内使用简单的IDE搜索功能找到这些功能。