[Resolved] Move Secondary Menu Below Entry Header

Home Forums Support [Resolved] Move Secondary Menu Below Entry Header

Home Forums Support Move Secondary Menu Below Entry Header

  • This topic has 5 replies, 2 voices, and was last updated 5 years ago by Leo.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #856157
    Krystal

    Hey guys,

    My site is local so I don’t have a link to share with you but I’m trying to hook the secondary menu into the after_entry_header location. Then that menu should display on only one page of my website. I’ve accomplished this but the secondary menu is displaying twice, once in its original location and once where I moved it. When I choose “No Navigation” for the secondary menu in the customizer, my site displays the menu once in the location I moved it to (like it’s supposed to) but then when I view the “live” version of the site both menus are gone.

    What I’ve done so far:
    – I’ve used the layout element to disable the secondary menu on all pages except the one it’s supposed to be on.
    – Added PHP to move the menu where I want it to display using this code:

    //Move secondary nav
    add_action( 'after_setup_theme','ka_move_secondary_nav' );
    
    function ka_move_secondary_nav() {
    	remove_action( 'generate_after_header', 'generate_add_secondary_navigation_above_header', 7 );
    	add_action( 'generate_after_entry_header', 'generate_add_secondary_navigation_after_header', 15 );
    }

    I’m not sure what to do next. Can you possibly point me in the right direction? If it would be possible to have the menu float right in its new location that’d be great as well.

    Thanks in advance!
    Krystal

    #856189
    Leo
    Staff
    Customer Support

    Hi there,

    Can you try this exact code here and make sure the secondary navigation location is set to below header?
    https://generatepress.com/forums/topic/page-header-image-above-menu/#post-288568

    If not then we will have to see the site live in question.

    Let me know ๐Ÿ™‚

    #856232
    Krystal

    Thanks Leo,
    The code you linked makes the menu only display one time but it puts the secondary menu above my main menu instead of below the entry header where I need it. I’ll try to edit the code and see if I can get it to move to where I want it.
    Krystal

    #856238
    Krystal

    The navigation is definitely set to below header btw, I forgot to mention that in my reply.

    #856245
    Krystal

    Got it with this code:

    //Move secondary nav
    add_action( 'after_setup_theme','ka_move_secondary_nav' );
    
    function ka_move_secondary_nav() {
    	remove_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 7 );
    	add_action( 'generate_after_entry_header', 'generate_add_secondary_navigation_after_header', 15 );
    }

    For some reason I had typed “above” instead of “after” in one of the functions. Once I fixed that it worked fine.

    Thanks for your help!

    #856247
    Leo
    Staff
    Customer Support

    Glad you figured out ๐Ÿ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.