Skip to content

Instantly share code, notes, and snippets.

@kristarella
Created March 18, 2014 05:31
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 kristarella/9614050 to your computer and use it in GitHub Desktop.
Save kristarella/9614050 to your computer and use it in GitHub Desktop.
Add items to a WordPress menu.
// Filter wp_nav_menu() to add additional links and other output
add_filter( 'wp_nav_menu_menu-name_items', 'new_nav_menu_items' );
function new_nav_menu_items($items) {
$homelink = '<li class="menu-item home"><a href="' . home_url( '/' ) . '">' . __('Home') . '</a></li>';
$items = $homelink . $items;
return $items;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment