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' => 'post',
'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 the_content(); ?>
<span><?php 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>
I call get_template_part('loop','review')
inside my my category.php
...
<?php
get_header();
if (is_category('portfolio')):
get_template_part('single','portfolio');
get_template_part('loop','review');
else:
get_template_part("single","blog");
endif;
get_footer();
?>
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'
)
);
}