Skip to content

Instantly share code, notes, and snippets.

@GaryJones
Forked from billerickson/gist:1326009
Last active April 16, 2019 14:56
Show Gist options
  • Save GaryJones/7387873 to your computer and use it in GitHub Desktop.
Save GaryJones/7387873 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