Plugin Author
Chouby
(@chouby)
No it’s not possible. Because we need to display the site in only one language. If a post has two, which one to take ?
What may be possible (I did not test) is to create a custom post type without activating the language and translation management. Polylang will not filter this content and will load the “preferred language” from cookie. This is what is done for media when unchecking “language and translation management for media” in Polylang settings.
Ok, thanks for your reply, good to know. But what about saying in the code that if the current language is “EN” (e.g.) it should nevertheless load the content of a post in “TR” (e.g.)?
Something like:
// switching from English to Turkish
if($curlang->slug=='en') {
$default_lang = 'en';
set_query_lang('tr');
// [...more code...]
// switching back to English
set_query_lang($default_lang);
set_query_lang() would have to be defined then, of course.
Regards
joschi81
Plugin Author
Chouby
(@chouby)
Oh… With PHP code, it’s somewhat different. I believe that you can reach a great level of customization by integrating some Polylang functions in your theme or in a plugin.
You can get the current language with pll_current_language()
and the default language with pll_default_language()
. You can query posts in the languages you want whatever the current language. For example:
$posts = get_posts(array(
'post_type' => 'post',
'lang' => 'de,fr', // query German and French posts
'showposts' => 5
));
You can also use this ‘lang’ parameter in ‘get_terms’.
More information is available in http://polylang.wordpress.com/documentation/documentation-for-developers/.
Thank you for your fast reply (as always!). I’ll do it like that.