Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active March 3, 2017 11:14
Show Gist options
  • Save billerickson/1326009 to your computer and use it in GitHub Desktop.
Save billerickson/1326009 to your computer and use it in GitHub Desktop.
Add Extra Code to Any Menu
<?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