Okay
  Public Ticket #1928659
Widgets
Closed

Comments

  •  3
    Sapan started the conversation

    Hello-

    How and where can i edit/add the widgets that comes in the drop down list in the Theme Options (please see attached screenshot).

    I do not need the date along with the customer login instead need a wishlist link on top bar, how to do that

    Thanks

  • [deleted] replied

    Hi Sapan,

    If want custom text or widget simply add your own text like shown below:

    medium
    (view large image)

    The result will be:

    medium
    (view large image)

    I hope this will help you.

  •  3
    Sapan replied

    Hello Arlind-

       thanks for the help. I want to show Customer Login/My Account and Cart Total on the top right. 

    Contact Us and Wishlist on the top left. Can you please provide the codes?

    Also, how can i edit an existing widget in the dropdown list.


    Thanks

    Sapan

  • [deleted] replied

    Hi Sapan,

    To show these custom widgets I have coded for you custom shortcodes to show in header > top menu, so please add this code in functions.php:

    function shortcode_customer_login_and_cart_total_text() {
        $myaccount_link = wc_get_page_permalink( 'myaccount' );
        if ( 0 == $current_user->ID ) {
            $no_registration = is_user_logged_in() || 'no' === get_option( 'woocommerce_enable_checkout_login_reminder' );
            if ( $no_registration ) {
                $widget = sprintf( __( '<a href="%1$s" class="top-menu--link">Customer Login</a>', 'aurum' ), $myaccount_link );
            } else {
                $widget = sprintf( '<a href="%1$s" class="top-menu--link">%2$s</a> %3$s <a href="%1$s" class="top-menu--link">%4$s</a>', $myaccount_link, __( 'Login', 'aurum' ), __( 'or', 'aurum' ), __( 'Register', 'aurum' ) );
            }
        } else {
            $widget = sprintf( '<a href="%1$s" class="top-menu--link">%2$s</a>', $myaccount_link, __( 'My Account Details', 'aurum' ) );
        }
        // Separator
        $widget .= '<span class="top-menu--separator">|</span>';
        // Date
        $widget .= sprintf( '<a href="%1$s" class="top-menu--cart-totals">%2$s <span class="top-menu--number">%3$s</span></a>', wc_get_cart_url(), __( 'Cart totals:', 'aurum' ), WC()->cart->get_cart_total() );
        return $widget;
    }
    function shortcode_contact_us_and_wishlist() {
        $widget = sprintf( '<a href="%1$s" class="top-menu--link">%2$s</a>', home_url( '/contact' ), 'Contact Us' );
        $widget .= '<span class="top-menu--separator">|</span>';
        $widget .= sprintf( '<a href="%1$s" class="top-menu--link">%2$s</a>', home_url( '/wishlist' ), 'Wishlist' );
        return $widget;
    }
    add_shortcode( 'customer_login_and_cart_total_text', 'shortcode_customer_login_and_cart_total_text' );
    add_shortcode( 'contact_us_and_wishlist', 'shortcode_contact_us_and_wishlist' );
    
    Then in Theme Options set these shortcodes:

    medium
    (view large image)

    The result:

    medium
    (view large image)

  •  3
    Sapan replied

    Hello Arlind-

      thank you so much for the help. One issue, once the user is logged in, can the CUSTOMER LOGIN text change to Hi [customer name] - LOGOUT

    Basically what i was looking for is

    Before login

    Hi Guest - Login or Register | Cart Total: $0.00

    After Login

    Hi [customer name] - Logout | Cart Total: $0.00


    Thanks a ton

    Sapan

  • [deleted] replied

    Hi Sapan,

    I understand, you can remove the previous code and add this code:

    https://d.pr/n/cp4vF1+
    

    This will add the logout URL and the name:

    medium
    (view large image)

  •  3
    Sapan replied

    Thanks, it worked.

  • [deleted] replied

    Hi Sapan,

    I'm happy to hear thatsmile.png

    I wish you a great day!

    Will set this ticket as solved from here.

    P.S: If you like the theme, it would help us a lot if you could give us a five-star rating on Themeforest from your Downloads tab.

    A huge thank you from me and Laborator in advance.