Created
March 6, 2014 13:47
-
-
Save alessandrotesoro/9390054 to your computer and use it in GitHub Desktop.
WordPress programmatically filter menu items given a location
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filter Menu Items | |
*/ | |
function tdp_filter_menu_items( $items, $args ) { | |
if($args->theme_location == 'primary_menu') | |
{ | |
$items .= '<li class="primary-menu-secondary-item"><a href="#">Menu Item</a></li>'; | |
} | |
return $items; | |
} | |
add_filter( 'wp_nav_menu_items', 'tdp_filter_menu_items', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment