Skip Navigation

[Resolved] Feed with CPT translations

This support ticket is created 3 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 1 voice.

Last updated by Puntorosso 3 years, 8 months ago.

Author
Posts
#2014953

Hi,

I have a CPT "object" created with Types and translated with WPML.

I need to collect 3 languages on a feed we created, and I use this code:

$id = get_the_id();
$id_en = apply_filters( 'wpml_object_id', $id, 'object', false, 'en' );
$id_es = apply_filters( 'wpml_object_id', $id, 'object', false, 'es' );

$post_de = get_post($id); 
$post_en = get_post($id_en); 
$post_es = get_post($id_es); 

$title_de = $post_de->post_title;
$title_en = $post_en->post_title;
$title_es = $post_es->post_title;

$description_de = $post_de->post_content;
$description_en = $post_en->post_content;
$description_es = $post_es->post_content;

But somehow the variable $id_en and $id_es do not deliver the post ids of the translated posts.

Do I miss something?
Thanks

#2014973

My issue is resolved now. Thank you!