Title: Need php template tag &amp; shortcode
Last modified: August 30, 2016

---

# Need php template tag & shortcode

 *  Resolved [pageii](https://wordpress.org/support/users/pageii/)
 * (@pageii)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/need-php-template-tag-shortcode/)
 * Great Plugin!
 * Is there a php template tag or shortcode? I want to get an array of post ids 
   for “most popular posts”, including custom-post types.
 * [https://wordpress.org/plugins/post-views-counter/](https://wordpress.org/plugins/post-views-counter/)

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

 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/need-php-template-tag-shortcode/#post-6566075)
 * There are both:
 * [post-views] shortcode
    pvc_post_views() – function with optional $post_id parameter
 *  Thread Starter [pageii](https://wordpress.org/support/users/pageii/)
 * (@pageii)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/need-php-template-tag-shortcode/#post-6566190)
 * Thank you for the tips.
 * Is the post count value stored as a post variable? I can’t seem to find the meta
   key name.
 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/need-php-template-tag-shortcode/#post-6566191)
 * Nope. It wouldn’t be effective for large traffic websites – that’s one of the
   reasons we’ve built this plugin.
 *  Thread Starter [pageii](https://wordpress.org/support/users/pageii/)
 * (@pageii)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/need-php-template-tag-shortcode/#post-6566192)
 * Yes, I’ve also be mulling over this and I tend to agreed with you. Do you have
   any tips for returning an array of post ids of “popular posts” by view count 
   registered under your plugin?
 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/need-php-template-tag-shortcode/#post-6566193)
 * Yea, you just use regular WP_Query or get_posts() with “orderby” parameter set
   to “post_views”.
 * Regards,
    Bartosz / dfactory
 *  Thread Starter [pageii](https://wordpress.org/support/users/pageii/)
 * (@pageii)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/need-php-template-tag-shortcode/#post-6566195)
 * That does it! You solved my problem entirely! I’m actually using WP query parameters
   as rendering variables and “post_views” is exactly what I had been looking for!
 * Your plugin works, is light weight, carefully balances performance issues, offers
   powerful options (e.g. multi-select specific custom post-types) and no frills.
   Your assistance is also prompt and precise. dFactory you are GREAT and folks 
   at Pageii Studio wants to say a big THANK YOU to you!
 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/need-php-template-tag-shortcode/#post-6566196)
 * Thx for the kind words 🙂

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

The topic ‘Need php template tag & shortcode’ 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/)

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [view count](https://wordpress.org/support/topic-tag/view-count/)

 * 7 replies
 * 2 participants
 * Last reply from: [dFactory](https://wordpress.org/support/users/dfactory/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/need-php-template-tag-shortcode/#post-6566196)
 * Status: resolved