How can I get a specific item from a wordpress menu? The function
returns all items, I want to get for example the second link in the list.
Function:
Output:
Desired output:
Please Note: this must be a server-side solution, I'm not looking to target menu items through CSS or JavaScript.
Thanks in advance!
Code:
wp_nav_menu
Function:
Code:
// HTML5 Blank navigation
function html5blank_nav()
{
wp_nav_menu(
array(
'theme_location' => 'header-menu',
'menu' => '',
'container' => '',
'container_class' => 'menu-{menu slug}-container',
'container_id' => '',
'menu_class' => '',
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '<ul class="ul-menu"> %3$s </ul>',
'depth' => 0,
'walker' => ''
)
);
}
Output:
Code:
<ul class="ul-menu">
<li><a href="#">menu item 1</a></li>
<li><a href="#">menu item 2</a></li>
<li><a href="#">menu item 3</a></li>
</ul>
Desired output:
Code:
<li><a href="#">menu item 2</a></li>
Please Note: this must be a server-side solution, I'm not looking to target menu items through CSS or JavaScript.
Thanks in advance!