• Resolved updatediva

    (@updatediva)


    I’d like to reorder the order of appearance of the secondary menu,primary menu and search bar in the header.

    In my child theme functions.php file, I changed the order of the hooks:
    `// Reorder the header menus
    add_action( ‘storefront_header’, ‘storefront_primary_navigation’, 0 );
    add_action( ‘storefront_header’, ‘storefront_secondary_navigation’, 20 );`

    This works, but then the original menu appears below it, so both menus are duplicated.

    You said in another post that changing header hooks in child-theme/functions.php file doesn’t work, that you have to ‘init’.

    Would you please explain how to make a change to the header in child-theme/functions.php and not have the theme/functions.php repeat.

Viewing 4 replies - 1 through 4 (of 4 total)
  • To add/remove components via child theme you should create a new function, hooked into init which includes all of your add_actions and remove_actions.

    Be aware that all this does is change the order the elements are loaded in, you’ll likely still need to apply some CSS to change the actual layout.

    Alternatively you could just grab the Storefront Designer extension which allows you to choose from several header layout options, and do much more.

    Thread Starter updatediva

    (@updatediva)

    Do you have an example of a new function using init? Or can you point me to one?

    Hey,

    You’d need to do something like this:

    add_action( 'init', 'jk_change_storefront_layout', );
    function jk_change_storefront_layout() {
    add_action( 'storefront_header', 'storefront_primary_navigation',	0 );
    add_action( 'storefront_header', 'storefront_secondary_navigation',	20 );
    }

    Thanks

    Thread Starter updatediva

    (@updatediva)

    Just what I was looking for, thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to reorder header items’ is closed to new replies.