Digital experiences for all disciplines
New Landing › How can we help? › Atelier › language switcher without account log in
New Landing › How can we help? › Atelier › language switcher without account log in
- This topic has 15 replies, 3 voices, and was last updated 9 years by Kyle – SUPPORT.
-
Posted in: Atelier
-
May 31, 2015 at 12:10 pm #179962
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,
TomJune 1, 2015 at 11:34 am #180229Hi,
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
June 1, 2015 at 12:08 pm #180240Dear 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, TomJune 2, 2015 at 3:06 pm #180732Can 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
June 2, 2015 at 3:23 pm #180745I tried it but it still shows the account log in (see screenshot).
Best, TomAttachments:
You must be logged in to view attached files.June 3, 2015 at 9:00 am #181015Hi,
In that case will need your site url.
Thanks-Rui
June 3, 2015 at 11:36 am #181072This reply has been marked as private.June 4, 2015 at 3:26 pm #181476Hi,
Add the code below to your custom css option.
.header-right li.menu-item { display:none; }
-Rui
June 4, 2015 at 4:07 pm #181498Thanks 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
June 5, 2015 at 9:45 am #181710Hi,
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
July 1, 2015 at 9:24 pm #190802Dear 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!
TomJuly 2, 2015 at 10:30 am #190935Hi
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
July 26, 2015 at 11:43 am #197740Hi 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, TomJuly 27, 2015 at 7:52 am #197901Ok no problem
September 1, 2015 at 3:01 pm #209244Wow! Now with V1.70 it is possible to display just the language switcher. Thanks so much. You are awesome!
-
Posted in: Atelier
You must be logged in to reply to this topic.