无码日韩精品一区二区三区免费,国产不卡a国内,2024年国产精品手机视频 http://zwiv.cn Wed, 15 Nov 2017 06:50:15 +0000 zh-Hans hourly 1 http://zwiv.cn/wp-content/uploads/2022/03/cropped-2022031822030060-32x32.png 修改時間排序 _ nicetheme_奈思主題 http://zwiv.cn 32 32 WordPress實現(xiàn)文章按修改時間排序 http://zwiv.cn/wordpress-shi-xian-wen-zhang-an-xiu-gai-shi-jian-pai-xu.html Tue, 24 Feb 2015 11:43:10 +0000 http://www.suxing.me/?p=717 WordPress下的默認(rèn)排序是按照發(fā)布時間排序,但有時候,如果按修改時間排序來的比較合理,特別是有一些資料代碼需要更改修正的時候。

下面,就說說已首頁最新文章列表為例,修改成按修改時間排序。

wordpress的排序方式

  • orderby=date 按發(fā)布日期排序
  • orderby=modified 按修改時間排序
  • orderby=ID 按文章ID排序
  • orderby=comment_count 按評論最多排序
  • orderby=title 按標(biāo)題排序
  • orderby=rand 隨機(jī)排序

用法

1、在首頁的PHP文件中搜索

<?php while ( have_posts() ) : the_post(); ?>

2、在while 前面加上下面這段代碼

$args = array(
 'showposts' => 10,
 'orderby' => modified,
 );
query_posts($args);

然后保存,即可完成最新文章按修改時間排序。

]]>