[Resolved] Dynamic Secondary Menu

Home Forums Support [Resolved] Dynamic Secondary Menu

Home Forums Support Dynamic Secondary Menu

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2324078
    Andrew

    Hey gang.

    My client has a business with 3 different sections, each with its own set of pages. I’m looking for a way to add menus dynamically to the Secondary Menu area depending on which area of the site they are viewing. It would be great to do this as an Element using the inside_secondary_menu hook but there’s one problem…. If I don’t manually assign a menu to the Secondary Menu area then it won’t show at all and no dynamic content is visible.

    Is there a way to ‘force’ a secondary menu area to be visible even when empty?

    All I can think is to add a dummy menu with display:none as CSS, or maybe a Menu with ‘Contact’ button. But maybe there’s a more elegant GP hook I could use? Maybe is there a way to replace existing content in the Secondary Menu hook with my dynamic content?

    #2324086
    Fernando
    Customer Support

    Hi Andrew,

    Why not just use hook before_header or after_header, and use the WP Navigation Block? Through this, you wouldn’t need to use the Secondary menu.

    #2324087
    Andrew

    I did try this in after_header but the container didn’t span full width. I will need to add some CSS to get it working properly but if that’s the recommended method I could.

    I was just wondering it there was an easier way.

    #2324089
    Andrew

    …. sorry I did just get it working – I was using after_header_content.

    I’m still curious if its possible to force an empty Secondary Menu area hook to be vailable.

    #2324094
    Fernando
    Customer Support

    Well, the way to make it appear is the one you tried, adding a menu and setting it to display none.

    Another good alternative is to use Conditional Menus: https://wordpress.org/plugins/conditional-menus/#:~:text=Description,categories%2C%20archive%20pages%2C%20etc.

    Through this, I believe you can set which menu would appear on specific pages.

    #2324096
    Andrew

    Wow that looks great. Thanks Fernando.

    #2324097
    Fernando
    Customer Support

    You’re welcome Andrew!

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