Skip to content

Instantly share code, notes, and snippets.

@cheh
Forked from billerickson/gist:1326009
Created March 11, 2014 20:49
Show Gist options
  • Save cheh/9494713 to your computer and use it in GitHub Desktop.
Save cheh/9494713 to your computer and use it in GitHub Desktop.
<?php
/**
* Add Extra Code to Any Menu
* @author Bill Erickson
* @link http://www.billerickson.net/customizing-wordpress-menus/
*
* @param string $menu
* @param object $args
* @return string modified menu
*/
function be_menu_extras($menu, $args) {
if( 'secondary' !== $args->theme_location )
return $menu;
return $menu . '<li class="right">Your extras go here</li>';
}
add_filter('wp_nav_menu_items','be_menu_extras', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment