我需要执行wordpress自定义字段循环:以下代码可以更好地描述:
<?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\' => \'difficulty\',
));
global $wp_query;
$total_results = $wp_query->found_posts;
echo \'<h2>"\'.$term->name . \'" Recipes</h2>\';
echo \'<h4 class="tcount">\'. $total_results . \' results</h4>\'; ?>
<hr class="aloha" />
<?php order_properties_menu(); ?>
<hr class="aloha" />
<?php $counter = 0; ?>
<?php while ($query->have_posts()): $query->the_post(); ?>
<div class="col-md-12 col-sm-6 col-xs-12">
<?php echo Chefscuisine_Template_Loader::load( \'recipes/grid\' ); ?>
</div>
<?php $counter++; endwhile; ?>
<? if ($counter % 4 === 0) {
echo \'<div class="midad">Advert 336x280px Here!</div>\';
} ?>
我得到了列表,但我现在需要的是tahonomy,例如,分类法模板中的平均难度,如何通过平均难度或轻松烹饪来实现这些都是自定义字段。它从类别模板中提取称为分类困难。php