[Resolved] override slideout navigation

Home Forums Support [Resolved] override slideout navigation

Home Forums Support override slideout navigation

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #362098
    madpiotr

    Hi Tom,

    I use slideuot navi.
    Can you tell me what would be the easiest way to override function generate_slideout_navigation()?

    Best regards
    Piotr

    #362259
    Tom
    Lead Developer
    Lead Developer

    What exactly are you wanting to do to it?

    #362266
    madpiotr

    Firstly
    I would like to comment wp_nav_menu() because I need it there and want to use something else (I know I can use CSS display:none to do it, but I do not like this solution).
    Then I wish to put my stuff there.
    If wp_nav_menu() ist not there I know I can use ‘generate_after_slideout_navigation’.

    Any suggest?

    Regards

    #362791
    Tom
    Lead Developer
    Lead Developer

    You could overwrite the function, but I don’t suggest it. It’s not promised that things won’t be added/removed from the function, and the function name might even change. If you watch updates closely and make adjustments as needed though, it won’t be an issue.

    remove_action( 'wp_footer','generate_slideout_navigation', 0 );
    add_action( 'wp_footer', 'tu_custom_slideout_nav' );
    function tu_custom_slideout_nav() {
    	$generate_menu_plus_settings = wp_parse_args( 
    		get_option( 'generate_menu_plus_settings', array() ), 
    		generate_menu_plus_get_defaults() 
    	);
    	
    	if ( 'false' == $generate_menu_plus_settings['slideout_menu'] ) {
    		return;
    	}
    	?>
    	<nav itemtype="http://schema.org/SiteNavigationElement" itemscope="itemscope" id="generate-slideout-menu" class="main-navigation slideout-navigation">
    		<div class="inside-navigation grid-container grid-parent">
    			<?php 
    			do_action( 'generate_inside_slideout_navigation' );
    			wp_nav_menu( 
    				array( 
    					'theme_location' => 'slideout',
    					'container' => 'div',
    					'container_class' => 'main-nav',
    					'menu_class' => '',
    					'fallback_cb' => 'generate_slideout_menu_fallback',
    					'items_wrap' => '<ul id="%1$s" class="%2$s slideout-menu">%3$s</ul>'
    				) 
    			);
    			?>
    			<?php do_action( 'generate_after_slideout_navigation' ); ?>
    		</div><!-- .inside-navigation -->
    	</nav><!-- #site-navigation -->
    	<div class="slideout-overlay" style="display: none;"></div>
    	<?php
    }
    #362821
    madpiotr

    Thanks Tom.

    it works well.
    I follow your work and updates since almost 3 years and generetepress is my favourite wordpress theme – thanks for this by the way ๐Ÿ˜‰

    I check always what new comes

    Warm regards

    #362824
    Tom
    Lead Developer
    Lead Developer

    Awesome! Thank you! ๐Ÿ™‚

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