• 29-05-2017, 01:45:49
    #1
    <?php 
    // Put the 'testimonials' id here
    $comments = get_comments("post_id=$post_id&status=approve");
    if ($comments) { $ndx = mt_rand(1,sizeof($comments)) - 1;
    $comment = $comments[$ndx]; }?>
    
     <H3>  <a href="#"><?php the_title(); ?></a>
                    </H3>
    
    <p>
    <?php echo $comment->comment_content; ?>
    </p>
    <p>
    <?php echo $comment->comment_author; ?>
    </p>
    bu kodlarla bir tane rastgele yorum getirebiliyorum ama benim 10-15 tane getirmem lazım. aynı kodu da alt alta on kere yazmak istemiyorum acil yardımlarınızı bekliyorum
  • 29-05-2017, 03:56:08
    #2
    ous_york adlı üyeden alıntı: mesajı görüntüle
    <?php 
    // Put the 'testimonials' id here
    $comments = get_comments("post_id=$post_id&status=approve");
    if ($comments) { $ndx = mt_rand(1,sizeof($comments)) - 1;
    $comment = $comments[$ndx]; }?>
    
     <H3>  <a href="#"><?php the_title(); ?></a>
                    </H3>
    
    <p>
    <?php echo $comment->comment_content; ?>
    </p>
    <p>
    <?php echo $comment->comment_author; ?>
    </p>
    bu kodlarla bir tane rastgele yorum getirebiliyorum ama benim 10-15 tane getirmem lazım. aynı kodu da alt alta on kere yazmak istemiyorum acil yardımlarınızı bekliyorum
    aşağıdaki kodları deneyin. kontrol etmedim, the_title hata verebilir, hata verirse echo $post_name kullanın.

    <?php 
    $comments = get_comments(array('post_id' => '', 'status' => 'approve', 'number'=>'10'));
    foreach($comments as $comment) :
    }?>
     <h3><a href="#"><?php the_title(); ?></a></h3>
    <p>
    <?php echo $comment->comment_content; ?>
    </p>
    <p>
    <?php echo $comment->comment_author; ?>
    </p>
    <?php endforeach; ?>
  • 29-05-2017, 04:57:12
    #3
    Üyeliği durduruldu
    <?php 
    
    	$args = array(
    		'number' => '2', // Kaç Adet Yorum İstiyorsanız
    	);
    
    	$comments = get_comments($args);
    	foreach($comments as $comment) :
    		echo '
    		Yazar Adı : ' . $comment->comment_author . '
    		Yorum : ' . $comment->comment_content . '
    		Yazar Mail : ' . $comment->comment_author_email . '
    		Yazar URL : ' . $comment->comment_author_url . '
    		Yorum Tarihi : ' . $comment->comment_date . '
    		Yorum Yapılan Post ID : ' . $comment->comment_post_ID  . '
    		';
    	endforeach;
    
    ?>
    Kodları güzel bir HTML içerisine yerleştirerek kullanabilirsiniz. Tüm yorumlardan istediğiniz kadar yorum getirir.