This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Otto 4 years, 5 months ago.

Assigned support staff: Otto.

Author Posts
June 15, 2015 at 9:10 am #638180

steffenL

Hello!

I have a DK language page where I getting custom fields from DK version of custom posts type called Artists. Is there a way for EN and DE version of same page to get fields still from DK version of custom posts instead of theirs EN and DE version.

Page I talking about: hidden link

Example what I am trying to get:

DK page - get fields from latest DK posts;
EN page - get fields from latest DK posts;
DE page - get fields from latest DK posts;

Any lang version of this page should get data only from one language.

Sorry if my example not clear. Feel free to add any additional questions.

June 15, 2015 at 4:58 pm #638829

Otto
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

Thank you for contacting the WPML support!

Is this a viable solution for your problem:
https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-using-content-duplication/

Or you can also set the custom post type to "not translate".

If not, you'll need some code customization.

This is an example query to retrieve the custom post in your default language:

global $sitepress;
 
//changes to the default language
$sitepress->switch_lang( $sitepress->get_default_language() );
 
$args = array(
      'post_type' => 'mycustompost',
      'meta_key' => 'mycustomfield',
      'meta_value' => 1,
      'suppress_filters' => false
);
 
$wp_query = new WP_Query( $args );
 
//changes to the current language
$sitepress->switch_lang( ICL_LANGUAGE_CODE );

Let me know if this helped.

Kind Regards

The topic ‘[Closed] Get info from English posts only’ is closed to new replies.