refining suggested publications query

This commit is contained in:
Antoine M 2023-12-20 09:33:22 +01:00
parent e05e8ef9ae
commit fde50094bb

View File

@ -55,14 +55,18 @@ get_header();
$args = array(
'post_type' => 'brochures',
'posts_per_page' => 5,
'orderby' => 'rand',
'post_status' => 'publish',
'meta_query' => array(
'orderby' => 'rand',
'meta_key' => 'brochure_pdf',
'meta_value' => false,
'meta_compare' => '!=',
'tax_query' => array(
array(
'key' => 'brochure_pdf',
'compare' => 'EXISTS'
'taxonomy' => 'thematiques',
'field' => 'term_id',
'terms' => $mainThematique->term_id,
)
),
)
);
$suggestedPublications = new WP_Query($args);
$pagePublicationsUrl = get_page_by_template('template-publications.php') ? get_permalink(get_page_by_template('template-publications.php')[0]->ID) : null;