wordpress文章列表倒叙输出代码


wordpress文章列表倒叙输出代码

<?php if(have_posts()) : ?>
<?php $args = array( 'cat' => get_query_var('cat'),'numberposts' => 10, 'order' => 'asc', 'post_status' => 'publish');
$rand_posts = get_posts( $args );foreach( $rand_posts as $post ) : ?>
<?php endforeach; ?>
<?php endif; ?>

'order' => 'asc'中
asc:从小知到大
desc:从大到小

文章发布时间:2020-05-22