lundi 28 septembre 2015

Polylang Switcher - Show/Hide for Widgets

Polylang Language Switcher help please... How can I code the switcher to show/hide in the sidebar? We need to code it directly in the template with a wrapper around it. Not just add it in the widgets. Can you help me finish this IF Else statement please?

<?php
if ( ????? ) { // if translations in the site exists show language switcher

    if (get_locale() == 'en_US') {
    echo '<section class="widget widget-related-content custom-sidebar<h3>Translation</h3>
';
} else {
echo '<section class="widget widget-related-content custom-sidebar<h3>'.pll__('Translation').'</h3>
';
}
pll_the_languages(
array('show_flags'=>1,
'show_names'=>1,
'hide_current'=> 1,
'hide_if_empty' => 1,
'force_home' => 0,
'hide_if_no_translation' => 1));
echo '
</section>';

} else {
// DO NOT SHOW ANYTHING
}
?>

Aucun commentaire:

Enregistrer un commentaire