Banneri Atla İçeriğe Yolculuk
Son Yorum En Üstte Görünsün
17 Ağustos, 2008 | 96 Okunma | Kategori: Wordpress | 

Wordpress sistemde varsayılan olarak konuya yapılan yorumlar tarih sırasına göre sıralanırlar.Son yazılan yorum en alta yerleşir bu şekilde.
Eklenti kullanmadan comments-template.php dosyamızda ufak bi oynamayla, yapılan son yorumu en üste taşıyacağız.
wp-includes/comments-template.php dosyanızı açın ve yorumları listeleyen aşağıdaki fonksiyonu bulun.

PHP:
  1. function comments_template( $file = '/comments.php' ) {

Bu fonksiyonun içinde aşağıdaki kısmı bulun.

PHP:
  1. /** @todo Use API instead of SELECTs. */
  2.     if ( $user_ID) {
  3.         $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = '1' OR ( user_id = %d AND comment_approved = '0' ) )  ORDER BY comment_date", $post->ID, $user_ID));
  4.     } else if ( empty($comment_author) ) {
  5.         $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date", $post->ID));
  6.     } else {
  7.         $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND ( comment_approved = '1' OR ( comment_author = %s AND comment_author_email = %s AND comment_approved = '0' ) ) ORDER BY comment_date", $post->ID, $comment_author, $comment_author_email));
  8.     }

Buradaki her "ORDER BY comment_date"
kısmını "ORDER BY comment_date DESC" olarak değiştirin.(Unutmayın, aynı şeyi 3 satır için de yapacaksınız.)
Yorumlarınız, yeniden eskiye doğru sıralanacaktır.


Etiketler: , , , ,


Bu Yazılar da İlginizi Çekebilir
  • İşte Biz Böyle Dostuz (Dinle-Hikaye)
  • Matematik Günlük Hayatta Ne İşe Yarar?
  • Yansıma Yazı Efekti
  • Ipod Figure
  • Adobe Photoshop CS3 Extended (10.1)

  • Yorum YapılmamışDüşünceni PaylaÅŸmak İstermisin?

    Durma, dök içini