Skip to content

Instantly share code, notes, and snippets.

@psflannery
Created August 21, 2013 13:26
Show Gist options
  • Save psflannery/6294430 to your computer and use it in GitHub Desktop.
Save psflannery/6294430 to your computer and use it in GitHub Desktop.
<?php
// call it using this code
get_template_part( 'menu', 'social' );
<?php
// this goes in functions.php
add_action( 'init', 'my_register_nav_menus' );
function my_register_nav_menus() {
register_nav_menu( 'social', __( 'Social', 'example-textdomain' ) );
}
<?php
// this will go in template-tags.php
if ( has_nav_menu( 'social' ) ) {
wp_nav_menu(
array(
'theme_location' => 'social',
'container' => 'div',
'container_id' => 'menu-social',
'container_class' => 'menu',
'menu_id' => 'menu-social-items',
'menu_class' => 'menu-items',
'depth' => 1,
'link_before' => '<span class="screen-reader-text">',
'link_after' => '</span>',
'fallback_cb' => '',
)
);
} ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment