Created
March 1, 2017 10:48
-
-
Save solid-pixel/a4d6039ccc40c4923afa64dcde7ac1a2 to your computer and use it in GitHub Desktop.
Add Custom Items to Specific WordPress Menus
This file contains hidden or 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
/*------------------------------------*\ | |
ADD CUSTOM ITEM TO MENU (ACF) | |
\*------------------------------------*/ | |
add_filter('wp_nav_menu_items','custom_menu_item', 10, 2); | |
function custom_menu_item( $items, $args ) { | |
if( $args->menu->slug == 'menu-1') { | |
$content = get_field('brochure-link', 'option'); | |
$items .= '<li>' . $content . '</li>'; | |
} | |
return $items; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment