Title: One additional usefull function
Last modified: August 20, 2016

---

# One additional usefull function

 *  [dawid-urbanski](https://wordpress.org/support/users/dawid-urbanski/)
 * (@dawid-urbanski)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/one-additional-usefull-function/)
 * Hi!
 * First: great plugin, very simple but usefull.
 * I wrote a little additional function to this plugin. I’ve noticed that if i want
   to show posts views on main page (or anywhere except single.php) that incerase
   view property even if no one see the article. So I’ve decided to add function
   _echo\_post\_views\_not\_counted()_ with is not adding view info to db. Now on
   every page I use this function, and on page single.php im using normal _echo\
   _post\_views()_. Maybe for someone it will be usefull.
 * Paste the following function in _wp-post-view.php_ file, below _echo\_post\_views()_
   function (in my case 19.03.2013 – ver 1.0) its 125 line).
 *     ```
       if (!function_exists('echo_post_views_not_counted')) {
   
           /**
            * Echo, print or display the views of the post.
            * @param <type> $post_id
            */
           function echo_post_views_not_counted($post_id) {
               if ($post_id) {
                   $views = wp_get_post_views($post_id);
                   echo number_format_i18n($views);
               } else {
                   echo 0;
               }
           }
   
       }
       ```
   
 * Use simply like other functions:
 * `<?php echo_post_views_not_counted($post->ID); ?>`
    or `<?php echo_post_views_not_counted(
   get_the_ID()); ?>`
 * [http://wordpress.org/extend/plugins/wp-post-view/](http://wordpress.org/extend/plugins/wp-post-view/)

Viewing 1 replies (of 1 total)

 *  [falsy](https://wordpress.org/support/users/cheolguso/)
 * (@cheolguso)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/one-additional-usefull-function/#post-3577855)
 * Thank you very much.

Viewing 1 replies (of 1 total)

The topic ‘One additional usefull function’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-post-view_76cbfe.svg)
 * [wp-post-view](https://wordpress.org/plugins/wp-post-view/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-post-view/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-post-view/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-post-view/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-post-view/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-post-view/reviews/)

## Tags

 * [counting](https://wordpress.org/support/topic-tag/counting/)
 * [function](https://wordpress.org/support/topic-tag/function/)
 * [not](https://wordpress.org/support/topic-tag/not/)
 * [views](https://wordpress.org/support/topic-tag/views/)

 * 1 reply
 * 2 participants
 * Last reply from: [falsy](https://wordpress.org/support/users/cheolguso/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/one-additional-usefull-function/#post-3577855)
 * Status: not resolved