Skip to content

Instantly share code, notes, and snippets.

@vajrasar
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vajrasar/a541f551d497eba63d8e to your computer and use it in GitHub Desktop.
Save vajrasar/a541f551d497eba63d8e to your computer and use it in GitHub Desktop.
Add custom Navigation Menu Location in Genesis.
<?php
/*
Part One: Registering the custom Menu
*/
add_action( 'init', 'register_my_menu' );
function register_my_menu() {
register_nav_menu( 'cpt-menu', __( 'CPT Menu' ) );
}
/*
Part Two: Place custom navigation in location of your choice
*/
/*
add the action in the location of your choice, we are implementing the menu
on before_header location, just for the sake of an example.
*/
add_action( 'genesis_before_header', 'vg_do_custom_nav' );
function vg_do_custom_nav() {
?>
<div class="wrap nav-primary">
<?php
wp_nav_menu(
array(
'theme_location' => 'cpt-menu',
'container_class' => 'genesis-nav-menu',
'fallback_cb' => '',
)
);
?>
</div>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment