Site logo

Archived topic

override slideout navigation

5 replies · Started by madpiotr on August 9, 2017

Viewing posts 1–6 of 6

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

What exactly are you wanting to do to it?

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

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
}

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

Awesome! Thank you! :)

This archived topic is closed to new replies.