我有问题。我希望这个循环的帖子按降序显示。但对于插件我必须坚持原始循环。所以我不能使用新的WP_Query或query_posts,因为这会覆盖原始循环。
这是我的循环。
<div id="main-filter">
<!-- Start the Loop. -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
?>
<!-- Test if the current post is in category 3. -->
<!-- If it is, the div box is given the CSS class "post-cat-three". -->
<!-- Otherwise, the div box is given the CSS class "post". -->
<?php if ( in_category( '3' ) ) : ?>
<div class="post-cat-three">
<?php else : ?>
<div class="post post-item">
<?php endif; ?>
<!-- Display the Title as a link to the Post's permalink. -->
<div class="ref-wrap">
<div class="col-sm-2 thumb-mobile">
<?php the_post_thumbnail(array(200,200)); // Declare pixel size you need inside the array ?>
</div>
<div class="col-sm-10">
<div class="entry">
<?php $bedrijf = get_field('naam_bedrijf'); ?>
<?php $feest = get_field('feest'); ?>
<?php $geschreven = get_field('geschreven_door'); ?>
<?php $datum = get_field('datum_referentie'); ?>
<?php $tekst = get_field('volledige_tekst'); ?>
<?php $link = get_field('mylink'); ?>
<?php echo '<p>Bedrijfsnaam: ' . $bedrijf . '</p>'; ?>
<?php $post_object = get_field('mylink');
if( $post_object ): $post = $post_object; setup_postdata( $post ); ?>
<p>Feest type: <a style="color:#ff6600" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
<?php echo '<p>Naam: ' . $geschreven . '</p>'; ?>
<?php echo '<p>Datum: ' . $datum . '</p>'; ?>
<?php echo '<p class="mobile-j">' . $tekst . '</p>'; ?>
<?php echo '<p>' . wp_review_show_total() . '</p>'; ?>
</div>
</div>
</div>
<div style="clear:both;"></div>
<!-- Display a comma separated list of the Post's Categories. -->
</div> <!-- closes the first div box -->
<!-- Stop The Loop (but note the "else:" - see next line). -->
<?php endwhile; else : ?>
<!-- The very first "if" tested to see if there were any Posts to -->
<!-- display. This "else" part tells what do if there weren't any. -->
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<!-- REALLY stop The Loop. -->
<?php endif; ?>
<?php wp_pagenavi(); ?>
</div>
无论如何我可以在DESC中订购这个循环吗?
**小编辑:我不知道这是否重要,但这是自定义分类法:referentie_type
答案 0 :(得分:0)
您可以将所有内容放在数组中而不是输出它,然后反向循环遍历该数组,然后输出它。
你的约束条件使得以一种巧妙的方式做到这一点几乎是不可能的。