New Landing How can we help? Atelier language switcher without account log in

Viewing 15 posts - 1 through 15 (of 16 total)
  • Posted in: Atelier
  • #179962
    freeheart
    Member
    Post count: 51

    Hello,

    I’m looking for a nice way to show the language switcher in the header. So far I have enabled the “Account” within the “Header Right Config”. This is fine but my visitors should not be able to log in. Would love to have an language icon on the top right that just lets you choose between languages. Do you have an idea?

    Thanks and Cheers,
    Tom

    #180229
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    If you are using WPML and choose in the header left/right config to show the links and also enable the Account Links – Translation it will show you a Drop-down with your languages.

    Hope it helps.

    -Rui

    #180240
    freeheart
    Member
    Post count: 51

    Dear Rui,
    that is exactly my problem. I don’t wont to show the account log in (I’m not using it) but still want to show the language selection. So far this only comes including the account log in.
    Best, Tom

    #180732
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Can you try to turn it on and add the code below to you custom css option to hide the account links?

    
    .tb-right li.menu-item{
    display:none;
    }

    -Rui

    #180745
    freeheart
    Member
    Post count: 51

    I tried it but it still shows the account log in (see screenshot).
    Best, Tom

    Attachments:
    You must be logged in to view attached files.
    #181015
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    In that case will need your site url.
    Thanks

    -Rui

    #181072
    freeheart
    Member
    Post count: 51
    This reply has been marked as private.
    #181476
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Add the code below to your custom css option.

    
    .header-right li.menu-item {
    display:none;
    }

    -Rui

    #181498
    freeheart
    Member
    Post count: 51

    Thanks Rui! That’s fantastic.

    Would there be an option to replace the account logo with a language icon? Then it would be perfect : )

    Best, Tom

    #181710
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Add the code below to your child theme functions.php but you need to replace this line with your desired content.

    $account_output .= '<a href="#"><i class="sf-icon-account"></i></a>' . "\n";

    function_exists( 'sf_get_account' ) ) {
            function sf_get_account() {
    
            	// VARIABLES
                $login_url         = wp_login_url();
                $logout_url        = wp_logout_url( home_url() );
                $my_account_link   = get_admin_url();
                $myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
                if ( $myaccount_page_id ) {
                    $my_account_link = get_permalink( $myaccount_page_id );
                    $logout_url      = wp_logout_url( get_permalink( $myaccount_page_id ) );
                    $login_url       = get_permalink( $myaccount_page_id );
                    if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) {
                        $logout_url = str_replace( 'http:', 'https:', $logout_url );
                        $login_url  = str_replace( 'http:', 'https:', $login_url );
                    }
                }
                $login_url       = apply_filters( 'sf_header_login_url', $login_url );
                $register_url	 = apply_filters( 'sf_header_register_url', wp_registration_url() );
                $my_account_link = apply_filters( 'sf_header_myaccount_url', $my_account_link );
    
    			if ( get_option( 'woocommerce_enable_myaccount_registration' ) && $myaccount_page_id ) {
    				$register_url = apply_filters( 'sf_header_register_url', $my_account_link );
    			}
    
                global $sf_options;
    
                $show_sub         = $sf_options['show_sub'];
                $show_translation = $sf_options['show_translation'];
                $sub_code         = __( $sf_options['sub_code'], 'swiftframework' );
                $account_output = "";
    
                // LINKS + SEARCH OUTPUT
                $account_output .= '<nav class="std-menu">' . "\n";
                $account_output .= '<ul class="menu">' . "\n";
                $account_output .= '<li class="parent account-item">' . "\n";
    			$account_output .= '<a href="#"><i class="sf-icon-account"></i></a>' . "\n";
    			$account_output .= '<ul class="sub-menu">' . "\n";
                if ( is_user_logged_in() ) {
                    $account_output .= '<li class="menu-item"><a href="' . $my_account_link . '" class="admin-link">' . __( "My Account", "swiftframework" ) . '</a></li>' . "\n";
                    $account_output .= '<li class="menu-item"><a href="' . $logout_url . '">' . __( "Sign Out", "swiftframework" ) . '</a></li>' . "\n";
                } else {
                    $account_output .= '<li class="menu-item"><a href="' . $login_url . '">' . __( "Login", "swiftframework" ) . '</a></li>' . "\n";
                    $account_output .= '<li class="menu-item"><a href="' . $register_url . '">' . __( "Sign Up", "swiftframework" ) . '</a></li>' . "\n";
                }
                if ( $show_sub && $sub_code != "" ) {
                    $account_output .= '<li class="parent"><a href="#">' . __( "Subscribe", "swiftframework" ) . '</a>' . "\n";
                    $account_output .= '<ul class="sub-menu">' . "\n";
                    $account_output .= '<li><div class="header-subscribe clearfix">' . "\n";
                    $account_output .= do_shortcode( $sub_code ) . "\n";
                    $account_output .= '</div></li>' . "\n";
                    $account_output .= '</ul>' . "\n";
                    $account_output .= '</li>' . "\n";
                }
                if ( $show_translation ) {
                    $account_output .= '<li class="parent aux-languages"><a href="#">' . __( "Language", "swiftframework" ) . '</a>' . "\n";
                    $account_output .= '<ul class="header-languages sub-menu">' . "\n";
                    if ( function_exists( 'sf_language_flags' ) ) {
                        $account_output .= sf_language_flags();
                    }
                    $account_output .= '</ul>' . "\n";
                    $account_output .= '</li>' . "\n";
                }
                $account_output .= '</ul>' . "\n";
                $account_output .= '</li>' . "\n";
                $account_output .= '</ul>' . "\n";
                $account_output .= '</nav>' . "\n";
    
                // RETURN
                return $account_output;
    
            }
        }
    

    if you replaced it by this one
    $account_output .= '<a href="#"><i class="fa-flag-o"></i></a>' . "\n";

    It will look like this
    https://www.dropbox.com/s/yfb26rmqavhlgf6/header_flag.png?dl=0

    -Rui

    #190802
    freeheart
    Member
    Post count: 51

    Dear Rui,

    sorry for my late reply.

    That would be so cool with the flag icon. But I’m not using a child theme because Atelier is so convenient without it. Is there another way to show the flag icon instead of the account icon?

    Thanks for your great work!
    Tom

    #190935
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    What do you mean by:

    I’m not using a child theme because Atelier is so convenient without it

    ?

    A child theme just allows you to add extra functionality and make changes

    – Kyle

    #197740
    freeheart
    Member
    Post count: 51

    Hi Kyle,

    I meant that Atelier has such great built-in features that an extensive customization without the need of a child theme is possible. Concerning the account icon: I will need it anyway soon. So I will leave it that way. Thanks for your help.
    Cheers, Tom

    #197901
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Ok no problem

    #209244
    freeheart
    Member
    Post count: 51

    Wow! Now with V1.70 it is possible to display just the language switcher. Thanks so much. You are awesome!

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.