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.

enter image description here

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()) : ?>
        <a href="#videos"><span class="home-head-toggle-item"><?php esc_html_e( 'Videos', 'template' ); ?></span></a>
<?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()) : ?>
        <a href="#culture"><span class="home-head-toggle-item"><?php esc_html_e( 'Culture', 'template' ); ?></span></a>
<?php endif; wp_reset_query(); ?>

Unfortunately, it didn't work as I expected and nothing appears.

enter image description here

Am I doing something wrong?

Let me know if you need further details.

Thanks in advance!

1 Answer 1


In your query post, I don't see your post type parameter. You must need this parameter to get all posts. Please try this follow the code and put it anywhere you want to show it.

$post_args = array(
    'post_type' => 'post', //get post by 'post' (default post type).
    'posts_per_page' => -1, //show all posts.
    'tax_query' => array( 
            'taxonomy' => 'category', 
            'field' => 'slug', 
            'terms' => array('culture') 
$the_qry = new WP_Query($post_args);

        //show all list the post.
        echo '<li>
                <a href="'.get_permalink().'">'.get_the_title().'</a>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.