Im有2个问题,查询未返回帖子My custom post type is supplier Showcase My custom taxonomy is supplier category分类中的类别是supplier cakes
另一个问题是,当我让它显示所有分类法帖子(所以所有在供应商类别下的类别中的帖子)时,我每页会收到300篇帖子,而不是25篇
<div class="gridcontainer">
<?php
// Grid Parameters
$counter = 1; // Start the counter
$grids = 5; // Grids per row
$titlelength = 20; // Length of the post titles shown below the thumbnails
// The Query
$args = array(
\'post_type\' => \'supplier-showcase\',
\'posts_per_page\' => 3,
\'tax_query\' => array(
array(
\'taxonomy\' => \'supplier-category\',
\'field\' => \'slug\',
\'terms\' => \'supplier-cakes\'
)
)
);
$query = new WP_Query($args);
// The Loop
if (have_posts()) :
while ( $query->have_posts() ) : $query->the_post();
// Show all columns except the right hand side column
if($counter != $grids) :
?>
<div class="griditemleft">
<div class="postimage">
<?php if ( has_post_thumbnail() ) : ?>
<a href="#<?php the_ID(); ?>" ><img src="<?php the_post_thumbnail_url(); ?>" /></a>
</div><!-- .postimage -->
<h2 class="postimage-title">
title is <?php the_title(); ?>
</h2><?php endif; ?>
<div id="<?php the_ID(); ?>" class="lightbox-by-id lightbox-content lightbox-white mfp-hide" style="max-width:600px ;padding:20px">
<img src="<?php the_post_thumbnail_url(); ?>" width="200px" height="200px" /> <br>
</div>
</div><!-- .griditemleft -->
<?php
// Show the right hand side column
elseif($counter == $grids) :
?>
<div class="griditemright">
<div class="postimage">
<?php if ( has_post_thumbnail() ) : ?>
<a href="#<?php the_ID(); ?>" ><img src="<?php the_post_thumbnail_url(); ?>" /></a>
</div><!-- .postimage -->
<h2 class="postimage-title">
title is <?php the_title(); ?>
</h2><?php endif; ?>
<div id="<?php the_ID(); ?>" class="lightbox-by-id lightbox-content lightbox-white mfp-hide" style="max-width:600px ;padding:20px">
<img src="<?php the_post_thumbnail_url(); ?>" width="200px" height="200px" /> <br>
</div></div><!-- .griditemright -->
<div class="clear"></div>
<?php
$counter = 0;
endif;
$counter++;
endwhile;
endif;
wp_reset_postdata();
?>
</div><!-- .gridcontainer -->
<?php get_footer(); ?>
有人能看到我在这里遗漏了什么吗。非常感谢。