你可能想看看storefront/inc/storefront-template-hooks.php
看见https://github.com/woocommerce/storefront/blob/1790927f8cab022bc96847fb0efc4f2f2ff6b2aa/inc/storefront-template-hooks.php
您可以在此处看到操作以及相关功能(和顺序):
add_action( \'storefront_header\', \'storefront_skip_links\', 0 );
add_action( \'storefront_header\', \'storefront_site_branding\', 20 );
add_action( \'storefront_header\', \'storefront_secondary_navigation\', 30 );
add_action( \'storefront_header\', \'storefront_primary_navigation_wrapper\', 42 );
add_action( \'storefront_header\', \'storefront_primary_navigation\', 50 );
add_action( \'storefront_header\', \'storefront_primary_navigation_wrapper_close\', 68 );
例如,选择第一个后,此处的函数为
storefront_skip_links
, 哪个在
storefront/inc/storefront-template-functions.php
(撰写本文时第279行!)看起来是这样的:
if ( ! function_exists( \'storefront_skip_links\' ) ) {
/**
* Skip links
*
* @since 1.4.1
* @return void
*/
function storefront_skip_links() {
?>
<a class="skip-link screen-reader-text" href="#site-navigation"><?php esc_attr_e( \'Skip to navigation\', \'storefront\' ); ?></a>
<a class="skip-link screen-reader-text" href="#content"><?php esc_attr_e( \'Skip to content\', \'storefront\' ); ?></a>
<?php
}
}
希望这能帮助您理解这在实践中是如何工作的!