Problem:
I'm trying to display all posts from a specific category named 'Culture' (slug: culture) in my website. However, I'm always getting an empty field.
My Attempt:
I've tried to use the same structure used in the custom template for other options. In this custom template, there's a tab container with 4 options: Latest, Trending, Videos and Galleries.
For example, to get all posts with a video post format there is this code:
<?php query_posts(array( 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-video' )) )); if (have_posts()) : ?>
<li>
<a href="#videos"><span class="home-head-toggle-item"><?php esc_html_e( 'Videos', 'template' ); ?></span></a>
</li>
<?php endif; wp_reset_query(); ?>
So I adapted it to:
<?php query_posts(array( 'tax_query' => array( array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => array( 'culture' ) )) )); if (have_posts()) : ?>
<li>
<a href="#culture"><span class="home-head-toggle-item"><?php esc_html_e( 'Culture', 'template' ); ?></span></a>
</li>
<?php endif; wp_reset_query(); ?>
Unfortunately, it didn't work as I expected and nothing appears.
Am I doing something wrong?
Let me know if you need further details.
Thanks in advance!