Site logo

Archived topic

Replacing navigation hook

5 replies · Started by David on September 15, 2017

Viewing posts 1–6 of 6

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

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

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?

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

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

No problem :)

This archived topic is closed to new replies.