How to query specific language?

the site i’m building will be in french and english. I’ve made CPT’s for outdoor activities and have some queries on my pages for those activities.

Problem is that i’ve built my pages and custom posts in french, and so the queries get the french posts. Now i’m using polylang to create english pages and posts.

The CPT name stays the same “activités été” and both my french and english posts are inside this cpt. How can i do so that my query shows only english or only french posts ?

@StrangeTech @Marius @Araminta any idea ?

If the queries are in templates, then it seems you may need to use template parts:

https://polylang.pro/doc/site-editor/

For translated pages it should already work.

If the language is not being passed into the query for some strange reason, you can potentially use a code block before the query block to add it (I haven’t tested this):

<?php
add_filter( 'cwicly/query/args', function( $query_args, $attributes, $id ) {
	if ($id === 'your-query-id-goes-here') {
		if ( function_exists( 'pll__' ) && ! is_admin()) {
			$lang_slug = pll_get_post_language( get_the_ID(), 'slug' );
			$query_args['lang'] = $lang_slug;
		}
	}
	return $query_args;
}, 10, 3 );
?>