Hi,
I’ve created a Content Template to use on my archives for a custom post type and taxonomy.
It’s working fine on the default archives.
My problem is in a custom archives template I’m creating for the parent terms in the custom taxonomy.
It’s not updating the content template, so it always shows the same post.
This is how I’m using it:
// $topic is the custom taxonomy, I get it from going over get_terms('as_learn_topic', $options) results
$topic_articles = get_posts(array(
'posts_per_page' => 4,
'post_type' => 'as_learn_article',
'tax_query' => array(
array(
'taxonomy' => 'as_learn_topic',
'field' => 'term_id',
'terms' => $topic->term_id,
)
)
));
foreach ($topic_articles as $post) :
// var_dump($post->post_title); --> this shows a different title on each iteration
generate_do_template_part('archive'); // --> this shows always the same post (is not the first one in the loop btw, looks random)
endforeach;
The thing is, at some point, I saw it working. I don’t remember changing anything related to it before it stopped working.
I can’t figure out the reason. Maybe am I using the content templates wrong?
Thanks for your time