| |
| |
Merhaba herkese..
Ana sayfamda çok okunan yazılar adında bir bölüm hazırladım ve aşağıda vermiş olduğum kod ile bu bölümü oluşturdum.
<?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 2"); foreach ($result as $post) { setup_postdata($post); $postid = $post->ID; $title = $post->post_title; $commentcount = $post->comment_count; if ($commentcount != 0) { ?>
Fakat anlayanlarında göreceği gibi bu kod ile yazılara yapılan yorum sayısına göre çekim yapılıyor.
'comment_count' fonksiyonu yerine dbye ekleyeceğimiz bir satır ile yazıların okunma sayısı elde edilip buraya farklı bir fonksiyon adı ile ekleyebilir miyim?
Umarım anlatabildim. Teşekkürler. |