请不要使用query_posts
. 有关说明,请阅读here.
要仅显示当天的帖子,您可以使用以下参数进行查询:
只需替换文件中的这两行:
<?php query_posts(\'showposts=15&orderby=comment_count&order=DESC&paged=\' . get_query_var(\'paged\'));?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
使用此选项:
<?php
$_args = array(
\'showposts\' => 15,
\'orderby\' => \'comment_count\',
\'order\' => \'DESC\',
\'paged\' => get_query_var(\'paged\'),
\'date_query\' => array(
array(
\'day\' => date(\'d\'),
\'monthnum\' => date(\'M\'),
\'year\' => date(\'Y\'),
),
),
\'meta_key\' => \'kklike_value\',
\'meta_value\' => \'meta_value_num\',
);
$loop = new WP_Query($_args);
if ($loop->have_posts()) :
while ($loop->have_posts()) : $loop->the_post(); ?>
Edited:
好的,您必须再添加这两个键和值。完整代码见上文。
\'meta_key\' => \'kklike_value\',
\'meta_value\' => \'meta_value_num\',