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

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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.

This topic contains 3 replies, has 2 voices.

Last updated by sarah.n 6 years, 8 months ago.

Assigned support staff: sarah.n.

Author Posts
March 26, 2013 at 10:27 pm #115181

Ian

As per the title. I can see the text on my homepage which is a regular WordPress post but there is no text showing on any of my translated product pages. How can I get this to show? Site is Mybeautycity.com

March 27, 2013 at 8:02 am #115210

sarah.n
Supporter

Languages: English (English ) German (Deutsch )

Hello Ian,

You can add the following function in your theme's functions.php file:

// LANGUAGE SELECTOR
// USAGE place this on the single.php, page.php
// function wpml_content_languages($args)
// args: skip_missing, before, after
// defaults: skip_missing = 1, before =  __('This post is also available in: '), after = ''
function wpml_content_languages($args=''){
    parse_str($args);
    if(function_exists('icl_get_languages')){
        $languages = icl_get_languages($args);
        if(1 < count($languages)){
            echo isset($before) ? $before : __('This post is also available in: ', 'sitepress');
            foreach($languages as $l){
                if(!$l['active']) $langs[] = '<a href="'.$l['url'].'">'.$l['translated_name'].'</a>';
            }
            echo join(', ', $langs);
            echo isset($after) ? $after : '';
        }    
    }
} 

Then call wpml_content_languages(); where you want "This post is also available in:" to display in your single product template file.

Let me know how you get on.

March 27, 2013 at 12:20 pm #115297

Ian

Thank you very much. I have added the code to my child theme functions.php. I guess I can add a piece of code in the single product page template but can you help with the exact syntax of the
call wpml_content_languages();

Thanks

March 28, 2013 at 7:25 am #115457

sarah.n
Supporter

Languages: English (English ) German (Deutsch )

Hey Ian,

Sorry I should have wrote about this better in my previous reply.

You'll need to add the following in your single product page template. If the section you want to add it to is already inside <?php ?> then you can skip the php tags.

<?php wpml_content_languages(); ?>

The topic ‘[Closed] How to get "This post is also available in…" on product pages with WooCommerce’ is closed to new replies.