Please make sure to update to WPML 4.3.6 and check our list of Known Issues before reporting

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Our next available supporter will start replying to tickets in about 11.39 hours from now. Thank you for your understanding.

This topic contains 8 replies, has 2 voices.

Last updated by spidercat 6 years, 2 months ago.

Assigned support staff: Stanley.

Author Posts
October 28, 2013 at 7:44 pm #283346

spidercat

Hello,

I'm using Pagelines Framework and I'm struggling to get the flags on the menu bar exactly as they are on the sidebar (please see the image) but nothing it's seems to work.
I set up the settings but I still have the description and just one language. I tried anything I found on the forum but nothing worked out.

I don't know If I did something wrong or else but I had to give up. Nothing seems to give me that result.
I'm not a programmer so anyone would help me please be very specific about what and where I have to intervene.

Thanks in advance.

October 29, 2013 at 7:53 am #283455

Stanley

Hello Spidercat,

I understand that you want to display a flag only language switcher in you menu. Is this correct? If so, you can use the following code. Please copy and paste what you see below to the functions.php file in your theme.

// Filter wp_nav_menu() to add additional links and other output
add_filter('wp_nav_menu_items', 'new_nav_menu_items', 10, 2);
function new_nav_menu_items($items, $args) {
        if (function_exists('icl_get_languages') && $args->theme_location == 'primary') {
                $languages = icl_get_languages('skip_missing=0');
                if(!empty($languages)){
                         foreach($languages as $l){
                                        $items = $items . '<li class="menu-item menu-item-language"><a href="' . $l['url'] . '"><img src="' . $l['country_flag_url'] . '" height="12" alt="' . $l['language_code'] . '" width="18" /></a></li>';
                        } 
                }
        }
return $items;
}

If you have any further questions on this, please let me know.

October 29, 2013 at 9:35 am #283539

spidercat

Hello Stanley,

I would like to display the two flag only horizontally in the menu bar.

I've already tried to put that code in the function.php of my theme but as a result the site doesn't display correctly, all the page disappear, I get only a white page.

October 29, 2013 at 11:02 am #283634

Stanley

Hello Spidercat,

I need to request temporary access (wp-admin and FTP) to your site in order to be of better help to you. You will find the needed fields for this below the comment area when you log in to leave your next reply.

Thank you!

November 5, 2013 at 12:36 am #286720

spidercat

Hello Stanley,

sorry for the delay, baking up everything took some time.

I provided the data in the form below.

I forgot to say that my WP site is multisite.

In WPML I have the italian as a primary language. I know it creates some problem with jigoshop but I prefer to keep it as it is than spending hours or even days translating all the website again as it happened in the past. So, if you think that is the problem, please keep in mind that I would rather prefer leaving everything as it is than getting crazy for days to reset all my website.

I know it probably sounds not very trustful but really, I'm not a pro and giving full access to my website caused me a lot of troubles in the past.

I'm sure you understand my worries.

Thank you!

November 5, 2013 at 7:35 am #286773

Stanley

Hello Spidercat,

I tested the code snippet below, and it works fine as screenshot attached. I put the code in the functions.php file under your theme folder, and I removed it after I tested.

// Filter wp_nav_menu() to add additional links and other output
add_filter('wp_nav_menu_items', 'new_nav_menu_items', 10, 2);
function new_nav_menu_items($items, $args) {
        if (function_exists('icl_get_languages') && $args->theme_location == 'primary') {
                $languages = icl_get_languages('skip_missing=0');
                if(!empty($languages)){
                         foreach($languages as $l){
                                        $items = $items . '<li class="menu-item menu-item-language"><a href="' . $l['url'] . '"><img src="' . $l['country_flag_url'] . '" height="12" alt="' . $l['language_code'] . '" width="18" /></a></li>';
                        } 
                }
        }
return $items;
}
November 5, 2013 at 12:41 pm #287055

spidercat

Hello Stanley,

there must be something I do wrong, because when I'm doing the same my website turns out as a white page without any content in it.

I put the same code at the end of the functions.php files inside the wp-content/themes/ignite folder
it is correct? And if it is why when I'm doing it the website disappear?

Since it seems you can make it works but I don't, would you please make it works again without deleting the code after?

November 6, 2013 at 12:27 pm #287771

Stanley

Hello Spidercat,

I just added the code in the functions.php file, and it works well. I hope it helps.

November 6, 2013 at 1:28 pm #287814

spidercat

That's great.
Thank you very much Stanley!