我为事件类别中的每个帖子设置了三个自定义字段-年、月和日。我已经在查询事件类别,现在我想按自定义字段对帖子进行排序。我假设我只需要在代码的query\\u posts部分插入一些内容,但我不确定是什么。有什么建议吗?
<?php query_posts(\'category_name=events&showposts=6\'); ?>
<?php while (have_posts()) : the_post(); ?>
<li>
<div class="date">
<span class="day"><?php echo get_post_meta($post->ID, \'month\', true); ?>/<?php echo get_post_meta($post->ID, \'day\', true); ?></span>
<span class="year"><?php echo get_post_meta($post->ID, \'year\', true); ?></span>
</div>
<div class="details">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> →</h3>
</div>
</li>
<?php endwhile; ?>
我可以解释更多:帖子的创建日期并不重要,但我想先按“年”自定义字段排序,然后按“月”自定义字段排序,然后按“日”自定义字段排序