對於所有與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搜索功能找到這些功能。