Hi jorge,
I’ve never used Polylang so the plugin definitely is not set up to handle those lang variables.
Do you know how I would retrieve the current language in the plugin?
with WPML the ICL_LANGUAGE_CODE with return the current language.
Cheers.
Hi dcooney
first, thank you for your help and cool plugin.
in the Polylang plugin, for what i see, the language is retrieved with pll_current_language() [1]
pll_current_language($value);
‘$value’ => (optional) either ‘name’ or ‘locale’ or ‘slug’, defaults to ‘slug’`
returns either the full name, or the WordPress locale (just as the WordPress core function ‘get_locale’ or the slug ( 2-letters code) of the current language.
best
jorge.
[1]http://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/
I keep on searching the solution, mean while I found this reply that might help with custom post / taxonomies and Polylang
https://wordpress.org/support/topic/pods-integration-with-polylang?replies=21#post-3712356
And here, with another plugin, is the same issue that I have now. and the author found a solution… hope it helps.
https://github.com/pods-framework/pods/issues/974
Ok thanks! I’m busy this week but will try to get to this as soon as I can.
Hello Darren
I have find the solution but, i believe you have to code it on the next version of ALM.
on the file ajax-load-more.php
I’ve commented this
//$lang = defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : '';
and queried polylang language
$lang = pll_get_post(('pll_current_language'));
I don’t know how to make it work in the way that it will recognize whether we have one plugin or the other or even better, use the wp language variable.
thank you for your great plugin, marking it as resolved
cheers.
Ok great!
I can take it from here!
Appreciate it.
I just tested this and this does not fix the issue. In fact the ‘lang’ parameter is essentially useless when querying by custom post type or standard posts/pages.
It appears that when querying by custom taxonomy values WP_Query() ignores the current language and just simply returns all results with that match the taxonomy terms.
I guess a fix would be to use language specific terms?
I had the site with access only to registered members and it did work but after I opened it to all access it is not working any more.
I wanted to check if it was my mistake before writing you.
thanks for your effort
jorge.
Hello Darren
sorry but the parameter lang is not useless when querying a custom post type… I’ve just hardcoded it as explained here and works:
<?php
$loop = new WP_Query(array('post_type' => 'CUSTOM_POST_TYPE', 'lang' => 'TWO_LETTER_LANG_CODE'));
while ( $loop->have_posts() ) : $loop->the_post(); ?>
I just need to know how to put it in the loop properly
sorry for the late reply, I couldn’t find time
Hi Jorge,
Ok, well I have left the lang param in ALM so we should be good there… Is there still an issue with your site?
I’ve updated the plugin but it was not doing properly for what I needed so I will check the whole code for my template and afterwards will tell you.
thanks again
jorge.