Quantcast
Channel: polylang – WordPress.org Forums
Viewing all articles
Browse latest Browse all 11471

joschi81 on "[Plugin: Polylang] Setting post language via custom post form"

$
0
0

Hi Chouby,

first of all: thanks for this great plugin. Everything's fine, works perfect.

However, there are two details that I don't manage to solve.

1st: How do I query all posts that have NO language set plus posts of specific languages?
I have this:
$query_string = 'posts_per_page=-1&post_type=post&lang=0';
All posts are shown.
With this:
$query_string = 'posts_per_page=-1&post_type=post';
No posts are shown.
When I put lang=0,en,sr, only posts with language set to English or Serbian are shown, but the posts with no language set are not there. I also tried lang=NULL,en,sr, which is not working as well. Any suggestions how to solve this issue?

2nd: I have a custom post form on a frontend page. How do I add a custom meta field for the Polylang plugin to detect the post's language? For other custom meta I do it like this:
add_post_meta($my_post_id, $my_post_meta_key, $my_post_meta_value,true);
I saw that in the DB's post_meta table, meta keys called '_translations' exist with a serialized value. My question is now: How do I create this serialized custom post meta value when a post is submitted? And what value do I need to use? Is it pll_current_language()?

Help is much appreciated!

Regards
joschi81

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


Viewing all articles
Browse latest Browse all 11471

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>