lksz
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Plugins
In reply to: [Polylang] Switcher disapears in attachment pageSolved.
I had to modify my filter to check if a condition is.attachment(); is met.Forum: Plugins
In reply to: [Polylang] Custom dropdawn duplication using pll_the_languages function.OK thanks, I’ll mark this topic as resolved.
Forum: Plugins
In reply to: [Polylang] Custom dropdawn duplication using pll_the_languages function.Thanks for reply mate, I actually just managed to figure it out using this aproach:
add_filter( 'wp_nav_menu_items', 'custom_menu_item', 10, 2 ); function custom_menu_item ( $items, $args ) { if (is_page() && $args->theme_location == 'main-nav') { $languages = pll_the_languages(array('raw' => 1)); $items .= '<li class="dropdown">'; $items .= '<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">'; if (function_exists('pll_current_language')){ $items .= pll_current_language('name'); }; $items .= '<span class="caret"></span>'; $items .= '</button>'; $items .= '<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">'; foreach ($languages as $lang) { $items.= '<div class = lang-item-"' . $lang['slug'] . '">'; $items.= '<a href ="' . $lang['url'] . '" hreflang = "' . $lang['slug'] . '">' . $lang['name'] . '</a>'; $items.= '</div>'; } $items .= '</ul></li>'; } return $items; }
Although one more thing is left to take care of. I would like to have a flag icon next to the selected language on my dropdawn button. Any ideas how it could be easily implemented ?
Forum: Plugins
In reply to: [Polylang] Custom dropdawn duplication using pll_the_languages function.Screenshot link:
<img src=’https://s8.postimg.org/aj5prxoy9/menu_bug.jpg’ border=’0′ alt=”menu bug” />
Viewing 4 replies - 1 through 4 (of 4 total)