• Hi,

    I am using the polylang plugin to translate my website into Polish. The feature slider for the default language works perfectly and takes all the posts from a certain category and displays them. However, the feature slider does not display posts for the new language, even though we have translated the correct category.

    The theme is using the standart WordPress function to get posts from the featured category ( query_posts() ), do I need to modify this? Or should it just work automatically?

    Any suggestions on what to do? Really hope someone can help with this!

    English site: http://www.tanzaniaexplorer.com
    Polish site: http://www.tanzaniaexplorer.com/pl/

    http://wordpress.org/extend/plugins/polylang/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Chouby

    (@chouby)

    I dont know exactly how is your code. Let’s say, you have:

    query_posts(array('cat' => $cat_id));

    to get posts from your featured category. You can just modify it like this:

    query_posts(array('cat' => pll_get_term($cat_id)));

    Thus, you will get the translated category in the current language.

    Thread Starter wahiine

    (@wahiine)

    Thanks so much for the reply!

    I want to get the posts for the same category in two different languages though. Polish category for the polish site and english for the english one.

    How do I get the code to select featured category based on language? So that different posts show for the different language sites?

    The code looks like this:

    if (get_option('estore_use_pages') == 'false') query_posts("showposts=$featured_num&cat=".get_catId($featured_cat));
    	else {
    		global $pages_number;
    
    		if (get_option('estore_feat_pages') <> '') $featured_num = count(get_option('estore_feat_pages'));
    		else $featured_num = $pages_number;
    
    		query_posts(array('post_type' => 'page',
    						'orderby' => 'menu_order',
    						'order' => 'DESC',
    						'post__in' => (array) get_option('estore_feat_pages'),
    						'showposts' => (int) $featured_num));
    	};
    Plugin Author Chouby

    (@chouby)

    Replace :

    if (get_option('estore_use_pages') == 'false') query_posts("showposts=$featured_num&cat=".get_catId($featured_cat));

    by

    if (get_option('estore_use_pages') == 'false') query_posts("showposts=$featured_num&cat=".pll_get_term(get_catId($featured_cat)));

    I don’t know how relevent to this thread, but I am having similar issues. The ‘Featured Image’ in a post works in french, but the same translated page will not show the ‘Featured Image’….

    Thread Starter wahiine

    (@wahiine)

    Thanks so much for the reply, but it still does not work.

    Even though the categories in the different languages are linked, the feature slider only shows the posts in the category that is chosen. That means that is shows either the posts for the polish category on the polish site or the posts for the english category on the main site, but never both together.

    I am getting a bit desperate to solve this, I can even hard code the three posts I need for each language. Any ideas on how to do that?

    I really appreciate the help!

    Plugin Author Chouby

    (@chouby)

    Sorry. I did not understood that you wanted both languages on the same page. Maybe like this, but I am not sure. It is not a common request.

    if (get_option('estore_use_pages') == 'false') query_posts("lang=en,pl&showposts=$featured_num&cat=".get_catId($featured_cat).",".pll_get_term(get_catId($featured_cat)));

    Thread Starter wahiine

    (@wahiine)

    Thanks a lot, but it still does not work. Any other suggestions?

    philzzz, have you had any luck solving it?

    Thread Starter wahiine

    (@wahiine)

    I think I know how to make it work, but I am no good at writing PHP. Is there someone who could help me translate this:

    if (get_option(‘estore_use_pages’) == ‘false’) and the language is english, show posts for category XX;

    if (get_option(‘estore_use_pages’) == ‘false’) and the language is polish, show posts for category XX;

    It is probably not the most awesome solution but it could work and I am desperate.

    Thank you so much! 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Polylang] Feature posts not showing for new language’ is closed to new replies.