I am using a child theme of the WordPress, WooCommerce theme Storefront.
Storefront header hooked functions are ordered this way:
<?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' ); ?>
I would like to change the order so the product_search
comes before the secondary_navigation
.
I have been through the storefront files and cannot find where this order is set, only the items individually.
Can anyone please help me to hook or do what is needed to change the order please?
The suggestion from @loictheaztec was missing the add_action as below –
For that purpose you will need first to remove it with
remove_action()
function and then you will hook it again withadd_action()
function, changing the priority from 40 to 25.Priority 25 is located between:
@hooked storefront_site_branding
– priority 20and
@hooked storefront_secondary_navigation
– priority 30Paste this code snippet in function.php of your active theme folder (or better in your active child theme folder):
Not sure if Loic got his answer to solve the duplicate issue, but to all that may need an answer, it needs to be wrapped in a function as suggested by Scott Eldo initially.
So…
as opposed to just putting it in function.php as such…
I tried editing the accepted answer, got rejected…
Every answer in this post has an error, the function name is not coincident with the add_action command….
So, it should be…
You can remove the actions, then add them in the order you would like them to appear: