[Resolved] Replacing navigation hook

Home Forums Support [Resolved] Replacing navigation hook

Home Forums Support Replacing navigation hook

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #385901
    David
    Staff
    Customer Support

    Hi Tom, i have used the following PHP to add shortcode content to the nav. It works great as long as a menu has been assigned to the nav or else nothing shows.

    add_action( 'generate_inside_navigation','db_add_shortcode' );
    function db_add_shortcode() {
            echo do_shortcode('[my shortcode content]');
    }

    Is it possible to hook this when no nav is assigned (humour me)?
    I dont want to use another hook as i want to keep the sticky nav function.

    thanks

    David

    #386046
    Tom
    Lead Developer
    Lead Developer

    Strange, that should work even if no menu is assigned. Can you link me to the page?

    #386066
    David
    Staff
    Customer Support

    Hi Tom, thanks for responding – i removed the shortcode and just added some html and you’re correct it does work when a menu isn’t assigned. It was to do with the shortcode which is now fixed.
    On a more basic level how do i stop WP from displaying the default Pages menu when a menu isn’t assigned?

    #386301
    Tom
    Lead Developer
    Lead Developer

    You would need to assign an empty menu to a theme location in Appearance > Menus.

    #386385
    David
    Staff
    Customer Support

    Thanks Tom, that’s my current fix so i’ll stick with that case resolved

    #386538
    Tom
    Lead Developer
    Lead Developer

    No problem 🙂

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