Last active
August 29, 2015 14:06
-
-
Save generatepress/47e6abb67b41883e1910 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Only keep the remove_action that applies to your navigation position set in the Customizer | |
// Delete the other remove_action calls that don't apply | |
add_action('after_setup_theme','generate_custom_remove_nav'); | |
function generate_custom_remove_nav() { | |
// Above header | |
remove_action( 'generate_before_header', 'generate_walker_navigation_position', 5 ); | |
// Float right | |
remove_action( 'generate_before_header_content', 'generate_walker_navigation_position', 5 ); | |
// Below header | |
remove_action( 'generate_after_header', 'generate_walker_navigation_position', 5 ); | |
} | |
// Choose the hook below that you have set in the Customizer - very important | |
// Remove the other add_action calls you don't use | |
// Above header | |
add_action( 'generate_before_header', 'generate_walker_navigation_position', 5 ); | |
// Float right | |
add_action( 'generate_before_header_content', 'generate_walker_navigation_position', 5 ); | |
// Below header | |
add_action( 'generate_after_header', 'generate_walker_navigation_position', 5 ); | |
// Your new navigation with the Walker | |
function generate_walker_navigation_position() | |
{ | |
?> | |
<nav itemtype="http://schema.org/SiteNavigationElement" itemscope="itemscope" id="site-navigation" role="navigation" <?php generate_navigation_class(); ?>> | |
<div class="inside-navigation grid-container grid-parent"> | |
<?php do_action('generate_inside_navigation'); ?> | |
<h3 class="menu-toggle"><?php _e( 'Menu', 'generate' ); ?></h3> | |
<div class="screen-reader-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'generate' ); ?>"><?php _e( 'Skip to content', 'generate' ); ?></a></div> | |
<?php | |
wp_nav_menu( | |
array( | |
'theme_location' => 'primary', | |
'container' => 'div', | |
'container_class' => 'main-nav', | |
'menu_class' => '', | |
'fallback_cb' => 'generate_menu_fallback', | |
'items_wrap' => '<ul id="%1$s" class="%2$s ' . join( ' ', generate_get_menu_class() ) . '">%3$s</ul>', | |
'walker' => new Your_New_Walker() | |
) | |
); | |
?> | |
</div><!-- .inside-navigation --> | |
</nav><!-- #site-navigation --> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment