Kodları denemedim ama çalışması lazım
<?php
function wpb_most_commented_posts() {
// start output buffering
ob_start();
?>
<ul class="most-commented">
<?php
// Run WP_Query
// change posts_per_page value to limit the number of posts
$args = array(
'date_query' => array(
//set date ranges with strings!
'after' => 'today', //Örnek 1 hafta öncesi için: "1 week ago" yazacaksın
'before' => 'today',
//allow exact matches to be returned
'inclusive' => true,
),
'orderby' => 'comment_count',
'order' => 'DESC',
'posts_per_page' => '200',
'paged' => '1',
);
$query = new WP_Query($args);
//begin loop
while ($query->have_posts()) : $query->the_post(); ?>
<a class="list-group-item" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" style="
padding-right: 28px;">
<?php the_title(); ?>
<span class="label label-default" style="
float: right;
position: absolute;
right: 10px;
top: 12px;
float: right;
">
<?php comments_number( '0', '1', '%' ); ?></span></a>
<?php endwhile;
// end loop
?>
</ul>
<?php
// Turn off output buffering
$output = ob_get_clean();
//Return output
return $output;
}
// Create shortcode
add_shortcode('wpb_most_commented', 'wpb_most_commented_posts');
//Enable shortcode execution in text widgets
add_filter('widget_text', 'do_shortcode');
Teşekkür ediyorum öncelikle bu kodda kullanışlı ama ben listenin son gun yapılan yorum sayısına göre listelenmesini istiyorum. burada son gun yazılan yazıları yorum sayısına göre listeliyor.