[Resolved] Change sticky navigation behavior for individual pages

Home Forums Support Change sticky navigation behavior for individual pages

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #331174
    Max

    I would love to customize my sticky navigation behavior from page to page, specifically with regards to the navigation logo and the animations. I’d like for the sticky navigation to slide in on the homepage and have the logo appear only on the sticky bar. On other pages, I’d like to have the logo in both the static and sticky bars and have no sticky effect. These are both achievable on the customizer, but you can’t assign page-specific behavior. I’m sure I need a hook, but I’m relatively new to hooks and don’t know what I’d do. Something of the form `<?php if ( is_front_page() ) { ?>
    PUT LOGO ONLY IN STICKY BAR AND SLIDE IN
    <?php } else { ?>
    PUT LOGO ON STATIC AND STICKY BAR WITH NO ANIMATION
    <?php } ?>` Any help would be greatly appreciated. Thanks!

    GeneratePress 1.3.46
    #331400
    Tom
    Lead Developer
    Lead Developer

    Hi Max,

    You could try this:

    add_filter( 'option_generate_menu_plus_settings','tu_dynamic_sticky_menu_setting' );
    function tu_dynamic_sticky_menu_setting( $options ) {
    	
    	if ( is_front_page() ) {
    		$options[ 'sticky_menu_logo_position' ] = 'sticky-menu';
    		$options[ 'sticky_menu_effect' ] = 'slide';
    	}
    	
    	return $options;
    }

    Then just set your settings in the Customizer for the “else”.

    #331961
    Max

    Looks like it worked perfectly. Thanks!

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