This post is also available in: İngilizce
Bu kod sayesinde ziyaretçilerinize yazınızın kaç defa okunduğunu eklentiye gerek kalmadan gösterebileceksiniz.
Adım 1
Tema dizinindeki Functions.php dosyasına aşağıdaki kodu ekleyin.
function getPostViews($postID){
$count_key = 'post_views_count';
$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 View";
}
return $count.' Views';
}
function setPostViews($postID) {
$count_key = 'post_views_count';
$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);
}
}
Adım 2
Single.php dosyasında The Loop içerisine şu kodu ekleyin.
<?php
setPostViews(get_the_ID());
?>
The Loop
The Loop kodlaması böyle başlayıp,
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>aşağıdaki gibi biter.
<?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?>
Adım 3
Bu koduda index.php ya da single.php’de okunma sayısının nerde gözükmesini istiyorsanız oraya ekleyin.
<?php
echo getPostViews(get_the_ID());
?>
This post is also available in: İngilizce
Bu kodu temanızın single.php ya da index.php dosyasında istediğiniz herhangi bir yere (The Loop idealdir.) ekleyerek ziyaretçilerinizin, yazılarınızı Stumbleupon’da paylaşmasını sağlayabilirsiniz.
The Loop
The Loop kodlaması böyle başlayıp,
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
aşağıdaki gibi biter.
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
Stumbleupon Kodu
<a href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>" rel="nofollow" title="vote up - <?php the_title(); ?>" target="_blank">Stumbleupon'da Paylaş</a>
This post is also available in: İngilizce
Bu kodu temanızın single.php ya da index.php dosyasında istediğiniz herhangi bir yere (The Loop idealdir.) ekleyerek ziyaretçilerinizin, yazılarınızı Delicious’ta paylaşmasını sağlayabilirsiniz.
The Loop
The Loop kodlaması böyle başlayıp,
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
aşağıdaki gibi biter.
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
Delicious Kodu
<a href="http://delicious.com/post?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>" rel="nofollow" title="Bookmark - <?php the_title(); ?>" target="_blank">Delicious'ta Paylaş</a>
This post is also available in: İngilizce
Bu kodu temanızın single.php ya da index.php dosyasında istediğiniz herhangi bir yere (The Loop idealdir.) ekleyerek ziyaretçilerinizin, yazılarınızı Facebook’ta paylaşmasını sağlayabilirsiniz.
The Loop
The Loop kodlaması böyle başlayıp,
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
aşağıdaki gibi biter.
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
Facebook Kodu
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>" title="Share this post on Facebook" target="blank" rel="nofollow">Facebook'ta Paylaş</a>
This post is also available in: İngilizce
Bu kodu temanızın single.php ya da index.php dosyasında istediğiniz herhangi bir yere (The Loop idealdir.) ekleyerek ziyaretçilerinizin, yazılarınızı Twitter’da paylaşmasını sağlayabilirsiniz.
The Loop
The Loop kodlaması böyle başlayıp,
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
aşağıdaki gibi biter.
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
Twitter Kodu
<a href="http://twitter.com/home?status=Reading: <?php the_title(); ?>" rel="nofollow" title="retweet on twitter">Twitter'da Paylaş</a>

English
Türkçe 

Yorumlar