• 10-05-2017, 03:14:15
    #1
    aşagıdaki kod tum zaman en fazla yorum yapılan konuları listeliyor

    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
    $query = new WP_Query('orderby=comment_count&posts_per_page=200'); 
    
    //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');
    Ama ben sadece bugün en çok yorum alan konuları listelemek istiyorum yardım eder misiniz?
  • 10-05-2017, 09:10:26
    #2
    ous_york adlı üyeden alıntı: mesajı görüntüle
    aşagıdaki kod tum zaman en fazla yorum yapılan konuları listeliyor

    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
    $query = new WP_Query('orderby=comment_count&posts_per_page=200'); 
    
    //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');
    Ama ben sadece bugün en çok yorum alan konuları listelemek istiyorum yardım eder misiniz?
    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');
  • 11-05-2017, 01:15:41
    #3
    aTKn94 adlı üyeden alıntı: mesajı görüntüle
    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.