• Ok… None of the solutions I’ve found online are working.

    I want to add new, custom items to the menu builder. More specifically, the logged in user’s profile items. Say…I want to put the user’s website link into one of the menus so I can display it wherever I want. That way if the user is logged in, it will show. If they are not, it won’t show.

    None of the solutions I’ve found online for adding custom menu items to specific menus have worked.

    If there is something I can add to the functions.php file or a plugin that will actually work…help would be appreciated.

Viewing 8 replies - 1 through 8 (of 8 total)
  • I’m not exactly sure if you are referring to your site’s primary menu or any back-end menus in the dashboard.

    Perhaps this plugin can be of use to you: https://wordpress.org/plugins/if-menu/

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Would you mind stating what solutions you’ve tried?

    I’d hate to link or suggest something you’ve already tried and didn’t work out.

    Thread Starter Kahil

    (@kahil)

    @wphelpout – That’s close…but not quite what I’m looking for.

    @jose – I basically tried several of the methods you can find for adding a login/logout link to a frontend menu. None of those options worked, likely because they were all kinda old.

    What I’m trying to do is something like the login/logout menu item, but instead of a login/logout link, it will display the current logged in user’s website url from their profile metadata. Ideally, it would be great if there were a plugin that let me do just that with user metadata from within the menu builder in WordPress. If there isn’t a plugin to do that…then someone has an idea for one. πŸ™‚

    I currently have it hard coded into one section of the site so it shows up and looks like it is part of one of the menu sections….but I’d like to be able to have it displayed anywhere I can display the menu.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Are you able to provide a link?

    It almost sounds like it would be a custom menu walker that could possibly be used. πŸ™‚

    Thread Starter Kahil

    (@kahil)

    @jose – Here is just one of many examples that doesn’t work: https://wordpress.org/support/topic/adding-loginlogout-to-thte-menu?replies=7

    There are several other examples you can find out there….and none of them worked.

    And yes…I’d like to filter in something that will show up in a specific menu. In my case, the secondary menu. That’s why ideally I’d like to find a plugin option that allows me to do that via the WordPress menu structure builder so I can just drag and drop where I want it. By default in the menu builder, as you know, we can add all the custom links we want…but I want to do that by taking it to the next level. In this case, calling specific user metadata.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Apologies, I guess what I meant to say was are you able to provide a link to what you are wanting to do? Or at least an example of what you are trying to do?

    Also are you able to provide a little more information? Like is this a multi-site install, bbpress, buddypress, single, what plugins have you looked at?

    The more information you give the better we can find the right solution for your needs. πŸ™‚

    Thread Starter Kahil

    (@kahil)

    This is just a simple self hosted WordPress install.

    There really is no way to link to an example because I haven’t seen it done anywhere.

    Let’s try this again…

    I will be creating accounts in wordpress for clients. They won’t have access to any aspect of the backend, all done in the front end via woocommerce. In the user website/url field, I will put in a link to a specific page for the client that is only viewable to them. I want to pull that url from the current logged in user’s metadata and display it as a menu item. That way it is unique for each logged in user.

    You can do this with a menu walker. Here’s an example that outputs the logged in user’s e-mail in the menu:

    function example_add_menu_navitem( $items ) {
    
    	if ( ! is_user_logged_in() ) {
    		return $items;
    	}
    
    	$user = wp_get_current_user();
    	$login_item = '<li class="login"><a href="' . get_site_url() . '">' . $user->user_email . '</a></li>';
    	$items .= $login_item;
    	return $items;
    
    }
    add_filter( 'wp_nav_menu_items', 'example_add_menu_navitem' );
Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Custom Menu Items for User Info’ is closed to new replies.