Problem:
How to show content of a custom post type in a specific language while WPML is active
Solution:
In the WP_Query try to use the lang attribute:
<?php $loop = new WP_Query( array ( 'post_type' => 'YOUR_CUSTOM_TYPE_SLUG', 'lang' => 'en', // use language slug in the query // 'lang' => 'de,fr', // query German and French posts // 'lang' => '', // query posts in all languages 'paged' => get_query_var( 'paged' ), 'posts_per_page' => 10, 'post_status' => 'publish', ) ); while( $loop->have_posts() ) : $loop->the_post(); ?> // html here <?php endwhile; ?>
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 4 replies, has 2 voices.
Last updated by 2 years, 5 months ago.
Assisted by: Christopher Amirian.