Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function new_nav_menu_items($items, $args) {
- $languages = apply_filters( 'wpml_active_languages', NULL, 'skip_missing=0' );
- if ( $languages && $args->theme_location == 'primary') {
- if(!empty($languages)){
- foreach($languages as $l){
- if(!$l['active']){
- $items = '<li class="menu-item"><a href="' . $l['url'] . '"><img src="' . $l['country_flag_url'] . '" height="12" alt="' . $l['language_code'] . '" width="18" /> ' . $l['native_name'] . '</a>' . $items;
- }
- }
- }
- }
- return $items;
- }
- add_filter('wp_nav_menu_items', 'new_nav_menu_items', 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement