WordPress Polylang WP_Query by Language

<?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; ?> // --------------------------------------------------- // NOTE: $_POST [ 'lang' ] & $_GET [ 'lang' ] for AJAX // ---------------------------------------------------

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.