Celebrating 7 Years! Get up to $30 off GeneratePress Premium!

[Support request] Sticky Navigation only on Home Page

Home Forums Support [Support request] Sticky Navigation only on Home Page

Home Forums Support Sticky Navigation only on Home Page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #517950
    Gary

    Is there a way to set the sticky navigation to function only on a set of pages?
    That is, I do not want it to function on home page but I want it on all others.

    Thanks.
    Gary

    GeneratePress 2.0.2
    GP Premium 1.5.6
    #518105
    Leo
    Staff
    Customer Support

    Hi there,

    With the sticky navigation turned on in the customizer, add this addtional snippet:

    add_filter( 'option_generate_menu_plus_settings','lh_exclude_home_sticky_menu_setting' );
    function lh_exclude_home_sticky_menu_setting( $options ) {
    	
    	if ( is_front_page() ) {
    		$options[ 'sticky_menu' ] = 'false';
    	}
    	return $options;
    }

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    #831375
    Jose

    Hi wonderful support team. In the same topic.

    How to exclude all “single pages” from sticky nav?

    #831506
    David
    Staff
    Customer Support

    Hi there you can change the if ( is_front_page() ) { conditional to if ( is_page() ) { this will target all single pages ( not posts )

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