homegrade_theme_production/taxonomy-thematiques.php

55 lines
1012 B
PHP

<?php get_header();
$term = get_queried_object();
echo '<pre>';
print_r($term);
print_r(is_tax('thematiques', 'thematiques'));
echo '</pre>';
$args = array(
'posts_per_page' => 1,
'post_type' => 'conseils',
'tax_query' => array(
array(
'slug' => 'locations',
'taxonomy' => 'thematiques',
'field' => 'slug',
'terms' => $term->slug,
'include_children' => false,
)
)
);
$query_thematique_posts = new WP_Query($args);
$thematique_related_page = $query_thematique_posts->posts[0];
if ($term->parent == 0) {
$args = array(
'child_of' => $term->term_id,
'taxonomy' => $term->taxonomy,
'hide_empty' => 0,
'hierarchical' => true,
'depth' => 1,
);
wp_list_categories($args);
}
// echo '<pre>';
// print_r($thematique_related_page);
// echo '</pre>';
// echo $the_query->posts[0]->post_content;
?>
<div class="container my-8 mx-auto">
<?php
echo $thematique_related_page->post_content;
?>
</div>
<?php
get_footer();