我尝试了很多东西,但不可能得到它的作品。订购WordPress的帖子最新评论
我终于删除了我的尝试
有一个插件呢?
SOLUTION:
在你function.php:
/**
* Comment_pre_save filter updates post_modified date
* to coincide with new comments. Since posts are ordered by
* post_modified, this will 'bubble' up more active posts to the top
*/
add_filter('preprocess_comment', 'update_post_modified');
function update_post_modified($comment_data){
global $wpdb;
$wpdb->update(
$wpdb->posts,
array(
'post_modified' => current_time('mysql'), // string
),
array('ID' => $comment_data['comment_post_ID']),
array(
'%s'
),
array('%d')
);
return $comment_data;
}
在你的index.php:
<?php $posts=query_posts($query_string . '&orderby=modified'); ?>
似乎是一个不错的主意,但它不工作...我说这function.php – user1708580
它的工作(见文章编辑) – user1708580
这是伟大的,如果你看评论的帖子的一部分。感谢和+1 – henrywright