Where do I find the functions triggered within a hook?

Looking at the current version of Storefront’s header.php:

/**
 * 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' ); ?>

That comment block outlines all of the callback functions (with priorities) hooked to the storefront_header action.

If you do a search for text within the files of the storefront directory for the string 'storefront_header', you can find these functions. There is no standard way of organizing where these functions appear, but you would be able to track them down manually starting at functions.php and following all of the code from there. Searching is more efficient though.

storefront_site_branding is the function that handles how the logo is displayed. It’s located in storefront/inc/storefront-template-functions.php.

Leave a Comment