• 07-12-2010, 11:26:03
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Eklentisiz sayfa sayac veya konu sayac Asagidaki verecegim fonksiyonu kullanmis oldugunuz temanin functions.php icerisine eklemeniz gerek
    function getKonu($postID){
        $count_key = 'konu_sayac';
        $count = get_post_meta($postID, $count_key, true);
        if($count==''){
            delete_post_meta($postID, $count_key);
            add_post_meta($postID, $count_key, '0');
            return "0 kez izlendi";
        }
        return $count.' kez izlendi';
    }
    function setKonu($postID) {
        $count_key = 'konu_sayac';
        $count = get_post_meta($postID, $count_key, true);
        if($count==''){
            $count = 0;
            delete_post_meta($postID, $count_key);
            add_post_meta($postID, $count_key, '0');
        }else{
            $count++;
            update_post_meta($postID, $count_key, $count);
        }
    }
    Ekledikten sonra yine temanizdan single.php yi acarak
    <?php while (have_posts()) : the_post(); ?>
    Burayi bulup asagidaki ile degistiriyoruz
    <?php while (have_posts()) : the_post(); setKonu(get_the_ID()); ?>
    Daha sonra hangi sayfamizda sayaci gostermek istiyorsak oraya
    <?php echo getKonu($post->ID, "konu_sayac", true); ?>
    Ekleyip bitiriyoruz..
  • 07-12-2010, 12:49:08
    #2
    sidebar a popüler konuları nasıl eklicez bu şekilde olursa