• I’m attempting to display posts from a ‘Uncategorized’ category under a custom taxonomy called ‘Reviews’ but without much luck.

    I’m using get_template_part('loop','review') to call loop-review.php which contains my taxonomy loop but for some reason, nothing will show up. What gives?

    Here are the contents of loop-review.php:

    <div class="row no-margin detail">
            <p class="title"><span>reviews</span></p>
            <?php 
    
            $args = array(
                'post_type' => 'page',
                'tax_query' => array(
                    array(
                        'taxonomy' 	=> 'review',
                        'field' 	=> 'slug',
                        'terms' 	=> 'uncategorized'
                    )
                )
            ); $review_query = new WP_Query($args); ?>
            <?php if ($review_query->have_posts()): ?>
                    <?php while ($review_query->have_posts()): $review_query->the_post(); ?>
                            <p class="quote">
                                    <?php $review_query->the_content(); ?>
                                    <span><?php $review_query->the_title(); ?></span>
                            </p>
                    <?php endwhile; ?>
                    <!-- end of the loop -->
                            <?php wp_reset_postdata(); ?>
    		<?php else:  ?>
                            <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
    		<?php endif; ?>
        </div>

    Lastly, here is the code from my functions.php

    add_action('init', 'build_taxonomies', 0);
        function build_taxonomies(){
                register_taxonomy('review', 'post', array(
                    'hierarchical'    => 'true',
                    'label'           => 'Reviews',
                    'query_var'       => 'true',
                    'rewrite'         => 'true'
                )
            );
        }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Why won't my taxonomy query show up?’ is closed to new replies.