[Support request] How to enable Secondary Navigation only on particular pages?

Home Forums Support [Support request] How to enable Secondary Navigation only on particular pages?

Home Forums Support How to enable Secondary Navigation only on particular pages?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #525144
    sumanta

    Hi,

    I want to enable Secondary Navigation only on particular pages not side wide? How to do that?
    GP Premium version: 1.5.5. Thank you.

    #525352
    Leo
    Staff
    Customer Support

    Hi there,

    We are currently on GP 1.5.6 so I would recommend updating: https://docs.generatepress.com/article/updating-gp-premium/

    As for hiding the secondary navigation, the disable element metabox should help: https://docs.generatepress.com/article/disable-elements-overview/

    #525641
    sumanta

    Thank you for your reply. But actually, I wanted to know if the secondary navigation can be disabled for a particular custom post type instead of disabling for an individual post each time we create a post (maybe programmatically?). I want to release the site for authors and it is not practically possible to ask them to disable secondary navigation every time they create a post.

    #525848
    Leo
    Staff
    Customer Support

    Can you link me to a post where you want to disable it?

    #526006
    sumanta

    Because this is an intranet portal, I cannot share you the link as it is not accessible from outside. I would like to know whether we can disable on a particular custom post type using some php code?

    #526476
    Leo
    Staff
    Customer Support

    Try this snippet:

    add_filter( 'option_generate_secondary_nav_settings','lh_cpt_secondary_nav_location' );
    function lh_cpt_secondary_nav_location( $options ) {
        $post_types = array( 'post-type', '​another-post-type' );
        if ( in_array( get_post_type(), $post_types ) ) {
            $options[ 'secondary_nav_position_setting' ] = '';
        }
        return $options;
    }
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.