开发者

Wordpress: Change sitewide category order?

开发者 https://www.devze.com 2023-03-29 01:32 出处:网络
I\'m trying to change the order in which my posts are displayed on m开发者_开发问答y category pages.

I'm trying to change the order in which my posts are displayed on m开发者_开发问答y category pages.

Let me know if you know how it's done. Cheers


You can add the following code before the start of the 'loop' to change the ordering of your posts:

<?php
$posts = query_posts($query_string .  '&orderby=title&order=asc');
// here comes The Loop!
if (have_posts()) : while (have_posts()) : the_post(); ?>

This will modify the loop to order posts by the title in ascending order. You can then just modify this orderby= and order= to change between the different fields and whether to order in ascending or descending order.

0

精彩评论

暂无评论...
验证码 换一张
取 消