Hi,
I’ve created a custom field (using CMB2), it’s just a checkbox. And now I want to create an archive that show only the posts with the checkbox turned to true.
I was able to create a query that returned only the posts that I want using:
$postsPT = new WP_Query( array(
'post_status' => 'publish',
'post_type' => 'any',
'meta_query' => array(
array(
'key' => 'idioma_checkbox',
'value' => "on",
// 'compare' => 'IN'
)
)
) );
But I can’t seem to figure out how the archives work. I’m able to create archives for custom post types, but not based on a custom field.
I duplicated the archive.php template because I want to keep the same design as the posts archive. But can’t figure out the best approach.
What template does generate_do_template_part( 'archive' );
uses?
Thanks