Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change the position of My Account from menu to submenu


  • guilhermeloganweb
    Participant

    @guilhermeloganweb

    I have searched high and low for this issue, but found no solution at all.

    (Note:
    My accout = Minha Conta
    Sair = Log Out)

    I’m trying to put the ‘Sair’ in ‘Minha Conta’ like submenu. Theses items, I added for php in functions, but I don’t know how I could do to change it.

    This is what I use in functions to add thats two items:

    add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
    function my_nav_menu_profile_link($menu) {
        if (! is_user_logged_in())
            return $menu;
        else
            $current_user = wp_get_current_user();
            $user = $current_user->user_login ;
            $class = 'sub-menu';
            $profilelink = '
                <li id="minha-conta-edit"><a id="minha-conta-edit-text" href="/usuarios/' . $user . '/">Minha Conta</a>
                <li><a href="'. wp_logout_url() .'">Sair</a></li>
      
                    <ul class=' . $class . '>
                        </li>
    
                    
                
            ';
            $menu = $menu . $profilelink;
            return $menu;
     
    }

    One image to exemplify: Here
    My website: Here

    Please, help.

    Thanks in advance.

  • You must be logged in to reply to this topic.
Skip to toolbar