WordPress.org

Ready to get started?Download WordPress

Forums

How to show number of times a blog post has been read (9 posts)

  1. kaberi
    Member
    Posted 4 years ago #

    Just wanted to show number of times a blog post has been read (irrespective of logged, not logged, admin, bot etc)

    I tried so many plugins but none seems to work with WP 3 (fresh installation as Multisite directory in a subdirectory).
    Either the counter does not increment or it shows nothing or shows error message.

    Does any one know of any simple working plugin that simply shows number of hits per post below each post's body and/or teaser and works out of the box with WordPress 3 ?

    Does WP 3 has this option in iteself hidden somewhere?

  2. kaberi
    Member
    Posted 3 years ago #

    Any help please ?

  3. kaberi
    Member
    Posted 3 years ago #

    Really no one ?

  4. chinmoy
    Member
    Posted 3 years ago #

  5. kaberi
    Member
    Posted 3 years ago #

    chinmoyda, in WP 3 ota kaaj korchhena

  6. chinmoy
    Member
    Posted 3 years ago #

    ok stay online. I will search on google. There have some plugin about this . I saw it many blogs. try blog stats plugin now. when i found the plugin i will provide you.

    Thanks
    C

  7. chinmoy
    Member
    Posted 3 years ago #

    Hey Kaberi,

    this plugin http://lesterchan.net/wordpress/readme/wp-postviews.html is working in my WP 3.0 blog. I checked it locally and it worked perfectly. In loop.php file you would be put this the_views() function.

    One most information is that you will put above function according to your blog's design.

    Thanks again
    Chinmoyda

  8. superpotion
    Member
    Posted 3 years ago #

    Putting the_views() in loop.php will show the post view count, but will not increment it. If you want to increment it within the loop, you must do this explicitly, for example:

    <?php
    if(function_exists('the_views')) :
       $custom_fields = get_post_custom();
       $post_views = intval($custom_fields['views'][0]);
       if (!update_post_meta($id, 'views', ($post_views+1))) :
           add_post_meta($id, 'views', 1, true);
       endif ;
       the_views();
    endif; ?>
  9. superpotion
    Member
    Posted 3 years ago #

    (My code above works, this one is untested) I just spotted the function in wp-postviews.php, which makes this a little more elegant:

    <?php if(function_exists('the_views')) :
       increment_views();
       the_views();
    endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic