如何在循环中读取分类法?下面是更好地解释的代码:
<?php $term = get_term_by(\'slug\', get_query_var( \'term\' ), get_query_var( \'taxonomy\' ) );
$query = new WP_Query(array(
\'post_type\' => \'recipe\',
\'meta_key\' => \'recipe_star_rating\',
\'orderby\' => \'meta_value_num\',
\'order\' => \'DESC\',
/// \'taxonomy\' => $term->slug,
));
$counter = 0;
global $wp_query;
$total_results = $query ->found_posts;
echo \'<h2>"\'.$term->name . \'" Recipes</h2>\';
echo \'<h4 class="tcount">\'. $total_results . \' results</h4>\'; ?>
<hr class="aloha" />
<?php while ($query->have_posts()): $query->the_post(); $counter++; ?>
<div class="col-md-12 col-sm-6 col-xs-12">
<?php echo Chefscuisine_Template_Loader::load( \'recipes/grid\' ); $counter++; ?>
</div>
<?php endwhile; ?>
<? if ($counter % 4 === 0) {
echo \'<div class="midad">Advert 336x280px Here!</div>\';
} ?>
所以我得到了清单,但并没有阅读困难-它可以是简单的,困难的,一般的。