solid-pixel
3/1/2017 - 10:48 AM

Add Custom Items to Specific WordPress Menus

Add Custom Items to Specific WordPress Menus

  /*------------------------------------*\
    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;
  }