Site logo

Archived topic

Issue with custom menu item

3 replies · Started by stardrive on September 20, 2016

Viewing posts 1–4 of 4

Hi Tom,

Please, custom menu item is not displaying in your secondary menu above the main menu.

I used this code:

function your_custom_menu_item ( $items, $args ) {
    if (is_single() ) {
        $items .= '<li>Show whatever</li>';
    }
    return $items;
}
add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );

In this case, Show whatever is my custom menu item.

Please, kindly assist

Regards,

Stardrive

Hi Tom,

Thanks for your response.

I replaced if (is_single() ) {
with

if(is_user_logged_in() && $args->theme_location == 'secondary')

and the code worked.

Sorry I should have informed you much earlier

Thank you.

No worries, glad you got it working :)

This archived topic is closed to new replies.