-
AuthorPosts
-
January 13, 2015 at 2:01 pm #378756
Would you please tell me how to paste the language switcher into the main header area
just align right to the menu and search iconlike this : https://copy.com/GU49TtBp6l9nCPZ1
Thanks a lot!
January 13, 2015 at 2:14 pm #378768Hey akzleung!
Can you post the link to your website please? We may need a temporary admin login as well. Where have you added polylang code?
Best regards,
YigitJanuary 13, 2015 at 3:52 pm #378852This reply has been marked as private.January 14, 2015 at 4:17 am #379245This reply has been marked as private.January 14, 2015 at 6:26 am #379266Hello,
Polylang switcher can be added to the menu from here (it is added right now). If you need a more complex implementation you’ll need to write some code, there is a WordPress filter you can use to append additional content to the main menu (we use this for the search icon, functions-enfold.php:56):
add_filter( 'wp_nav_menu_items', 'append_polylang_func', 100, 2 ); function append_polylang_func ( $items, $args ) { $items .= "Polylang language switcher function here"; return $items; }
Here’s some reference to the Polylang language filter function and its parameters:
https://polylang.wordpress.com/documentation/frequently-asked-questions/the-language-switcher/
https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/Regards,
JosueJanuary 14, 2015 at 10:28 am #379344This reply has been marked as private.January 14, 2015 at 5:47 pm #379579Hey Akzleung!
To which file did you add the code?
Regards,
JosueJanuary 15, 2015 at 4:23 am #379868This reply has been marked as private.January 15, 2015 at 4:29 am #379871This reply has been marked as private.January 16, 2015 at 1:31 am #380558Hi Akzleung!
I’m unable files from the Dashboard, try changing your code to:
if(!function_exists('avia_append_search_nav')) { //first append search item to main menu add_filter( 'wp_nav_menu_items', 'avia_append_search_nav', 10, 2 ); add_filter( 'wp_nav_menu_items', 'append_polylang_func', 100, 2 ); function append_polylang_func ( $items, $args ) { if ((is_object($args) && $args->theme_location == 'avia') || (is_string($args) && $args = "fallback_menu")) { $items .= '<div class="lang_switcher_polylang">'.pll_the_languages()."</div>"; } return $items; } add_filter( 'avf_fallback_menu_items', 'avia_append_search_nav', 10, 2 ); function avia_append_search_nav ( $items, $args ) { if(avia_get_option('header_searchicon','header_searchicon') != "header_searchicon") return $items; if(avia_get_option('header_position', 'header_top') != "header_top") return $items; if ((is_object($args) && $args->theme_location == 'avia') || (is_string($args) && $args = "fallback_menu")) { global $avia_config; ob_start(); get_search_form(); $form = htmlspecialchars(ob_get_clean()) ; $items .= '<li id="menu-item-search" class="noMobile menu-item menu-item-search-dropdown"> <a href="?s=" rel="nofollow" data-avia-search-tooltip="'.$form.'" '.av_icon_string('search').'><span class="avia_hidden_link_text">'.__('Search','avia_framework').'</span></a> </li>'; } return $items; } }
Cheers!
JosueJanuary 16, 2015 at 5:25 am #380595This reply has been marked as private.January 19, 2015 at 6:54 pm #382014Hi!
You needed to pass the echo=0 argument to the
pll_the_languages
function so it doesn’t automatically shows, check it now. I also added this to Quick CSS:.lang_switcher_polylang { position: absolute; top: 0; right: -100px; } .lang_switcher_polylang li{ display: block; float: none; } .av-main-nav { position: relative; right: 100px; }
Cheers!
JosueJanuary 20, 2015 at 9:26 am #382333Hi Josue,
It works!
Thank you very much for your time and all your support team!Best wish,
AkzleungJanuary 20, 2015 at 10:00 am #382346You are welcome Akzleung, always glad to help :)
Regards,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.