[Resolved] Remove secondary nav using hooks

Home Forums Support [Resolved] Remove secondary nav using hooks

Home Forums Support Remove secondary nav using hooks

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #358020
    Anthony

    Hi,

    I’d like to remove the secondary nav on all pages except posts but I don’t want to hide it using css rules, as explained in previous posts.

    I prefer to not output it at all. How can I do it using hooks?

    Thank you

    #358141
    Tom
    Lead Developer
    Lead Developer

    You should be able to do something like this:

    add_filter( 'option_generate_secondary_nav_settings','tu_dynamic_secondary_nav' );
    function tu_dynamic_secondary_nav( $options ) {
    	
    	if ( ! is_singular( 'post' ) ) {
    		$options[ 'secondary_nav_position_setting' ] = '';
    	}
    	
    	return $options;
    }

    Let me know ๐Ÿ™‚

    #358229
    Anthony

    Perfect it works. Thank you.

    Is there somewhere more information on all these options? I’ve found the hooks and filters documentation pages to be not exhaustive.

    #358443
    Tom
    Lead Developer
    Lead Developer

    This is actually a core WordPress filter which allows you to filter into any option – super useful. I’ll work on adding some docs for it ๐Ÿ™‚

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