Title: PHP for inserting counter into theme?
Last modified: August 22, 2016

---

# PHP for inserting counter into theme?

 *  Resolved [jf80](https://wordpress.org/support/users/jf80/)
 * (@jf80)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/php-for-inserting-counter-into-theme/)
 * Thanks for the useful plugin.
 * Is there a way to add this counter to the area of the post template where the
   date is displayed so its in-line with that info?
 * If you could provide the PHP for hard coding this info into the single.php file
   that would be great.
 * Thanks.
 * [https://wordpress.org/plugins/post-views-counter/](https://wordpress.org/plugins/post-views-counter/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/php-for-inserting-counter-into-theme/#post-5306684)
 * Yes, of course.
 * All the public function are located in plugin includes/functions.php/
 * For example pvc_get_post_views(), pvc_post_views(), pvc_get_most_viewed_posts(),
   pvc_most_viewed_posts().
 * These are pluggable functions as well, so you can override it’s output if you
   need to. However each one has filters to do the same without copying the files.
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/php-for-inserting-counter-into-theme/#post-5306885)
 * Hello, dFactory!
 * I’ve an issue with the plugin… it gets duplicate when I use a post different 
   than “default”, in this case “video” post.
 * EDIT:
 * For everyone! In settings use the manual position and after the article in single.
   php paste this: <?php echo do_shortcode (‘[post-views]’);?>
 * That fix my problem with double location with another posts than “default”.
 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/php-for-inserting-counter-into-theme/#post-5306888)
 * Or you can use the functions I mentioned above.
 *  [Karalius](https://wordpress.org/support/users/karalius/)
 * (@karalius)
 * [11 years ago](https://wordpress.org/support/topic/php-for-inserting-counter-into-theme/#post-5306924)
 * how to make it appear **in one line**?
    when i add it, i.e. next to the date,
   it goes into other line…
 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/php-for-inserting-counter-into-theme/#post-5306925)
 * The easiest way would be to call: `pvc_get_post_views()` function and then output
   the result styled the way you want to.
 * You may also give it a post ID parameter to get views for any specific post, 
   for eg.: `echo pvc_get_post_views( 24 )` for post of ID 24. If you don’t provide
   the ID parameter, the plugin tries to get the ID automatically (from the global
   $post).

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘PHP for inserting counter into theme?’ is closed to new replies.

 * ![](https://ps.w.org/post-views-counter/assets/icon-256x256.png?rev=2973820)
 * [Post Views Counter](https://wordpress.org/plugins/post-views-counter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-views-counter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-views-counter/)
 * [Active Topics](https://wordpress.org/support/plugin/post-views-counter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-views-counter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-views-counter/reviews/)

 * 5 replies
 * 4 participants
 * Last reply from: [dFactory](https://wordpress.org/support/users/dfactory/)
 * Last activity: [10 years, 12 months ago](https://wordpress.org/support/topic/php-for-inserting-counter-into-theme/#post-5306925)
 * Status: resolved