WordPress sitenizde popular konuları göstermek istiyorsanız ve bunu eklentisiz yapmak istiyorsanız buradaki kodlada yapabilirsiniz. Eklentilerle bunları yapmak aslında çok kolay ancak kodlarlada bunu yapıp eklentileri engelleyebilirsiniz.
Not: Aşağıdaki kod 5 tane gösteriyor siz isterseniz limit kısmından ayarları değiştirebilirsiniz. Daha çok veya daha az populer konu gösterebilirsiniz.
WordPress Populer konular
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <h2>Popular Posts</h2> <ul> <?php $result = $wpdb ->get_results( "SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5" ); foreach ( $result as $post ) { setup_postdata( $post ); $postid = $post ->ID; $title = $post ->post_title; $commentcount = $post ->comment_count; if ( $commentcount != 0) { ?> <li><a href= "<?php echo get_permalink($postid); ?>" title= "<?php echo $title ?>" > <?php echo $title ?></a> {<?php echo $commentcount ?>}</li> <?php } } ?> </ul> |
Kaynak linkleri:
Create Your Own Popular Posts Page
How to List Your Most Popular Posts
hocam peki bunu haftalık aylık olarak nasıl ayarlarız bir fikriniz var mı ?
Hasan bey, http://wordpress.org/plugins/baw-post-views-count/ bu eklentiyi kullanarak aylık, yıllık listeleme yapabilirsiniz.
Ertuğrul Bey Merhaba ,
Benim halihazırda eklentisiz çalışan ve siteme uyarladığım güzel bir Popüler Yazım Mevcut Ama Benim İstediğim bunu Haftalık Olarak Düzeltmek. Eklenti kullanmıyorum.