Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10007

    Hi Dude,

    I have the woocommerce plugin activated on my abundance theme. By default, the secondary menus are created automatically and are related to the woocommerce functions. If i add menus to it via the wp admin menu panel, the default will be changed with the one i created.

    Current Situation:

    1. By default, if the user is logged in the, links on the secondary menu show “My Account | Shopping Cart | Check out”

    2. By default, if the user is not logged in, the links on the secondary menu show “Register | Login | Shopping Cart | Check out”

    So it is dependent on the login status.

    My problem:

    If a registered user wants to login, he hits the “login” link, then what it does it tries to open the account page (which has the woo commerce my account shortcode. This now becomes the error. The login page should be “website url/wp-login.php or “website url/wp-admin and not my account (woo commerce) page.

    My Dilemma

    1. If change the secondary menu on the wp- admin menu panel, the intelligence in terms of displaying the links depending on the login status will be gone, and will always stay as I set.

    2. Im looking for the fastest way around it, which is to set or change the link directly on the “login” link itself. It doesn’t seem to be available in the woo commerce options, so i thought that it was an abundance issue that I can get help from you? What template or php file/s can I edit to fix that.

    Anyway, hope that I gave you a clear picture of my scenario. I know that you guys get a lot of support requests and reading through all of them may be confusing sometimes.

    Thanks in advance.

    Best,

    Marc

    #66557

    Hello, anybody there?

    #66558

    You can try to hook into the second menu. Add following php code to the bottom of functions.php and adjust the link text or target if required:

    function add_login_logout_link($items, $args)
    {
    if(is_user_logged_in() && $args->theme_location == 'avia2')
    {
    $newitems = '<li><a title="'.__('Logout','avia_framework').'" href="'. wp_logout_url(get_permalink()) .'">'.__('Logout','avia_framework').'</a></li>';
    $newitems .= '<li><a title="'.__('My Account','avia_framework').'" href="'. admin_url() .'/profile.php">'.__('My Account','avia_framework').'</a></li>';
    $newitems .= $items;
    }
    else if($args->theme_location == 'avia2')
    {
    $newitems = '<li><a title="'.__('Login','avia_framework').'" href="'. wp_login_url(get_permalink()) .'">'.__('Login','avia_framework').'</a></li>';
    $newitems .= $items;
    }else{
    $newitems .= $items;
    }
    return $newitems;
    }
    add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Secondary Menu Behavior’ is closed to new replies.