This function allows you to get the number of views of a given post or array of post. Optionally for the specified time period. Usage pvc_get_post_views( $post_id = 0, $period = ‘total’ ); Parameters $post_id int / array required Post ID or array of post ID’s $period string optional pro The time period from which […]


Displays a post’s total post views along with the label and/or icon. The function gathers all of the data, prepares the display, and then displays the post views container. Usage pvc_post_views( $post_id = 0, $echo = true ); Parameters $post_id int required Stores the post’s ID. $echo boolean Determines whether the post views should be […]


Gets the most viewed posts ordered by views count. This function is a wrapper for get_posts() and it accepts all the get_posts() parameters. Usage pvc_get_most_viewed_posts( $args = array() ); Parameters $args array Array of optional arguments Return Array of most viewed posts stored in the array of post objects. Example Getting pages ordered by post […]


Displays a list of the most viewed posts. The function declares an array of default $args parameters. Default parameters $args = array( ‘number_of_posts’ => 5, ‘post_type’ => array( ‘post’ ), ‘order’ => ‘desc’, ‘thumbnail_size’ => ‘thumbnail’, ‘show_post_views’ => true, ‘show_post_thumbnail’ => false, ‘show_post_excerpt’ => false, ‘no_posts_message’ => __( ‘No Posts’, ‘post-views-counter’ ) ); Usage pvc_most_viewed_posts( $args […]


Allows the user to view a given post manually. Usage pvc_view_post( $post_id = 0 ); Parameters $post_id int Post ID Return The function returns a bool value. FALSE if the post doesn’t exist; TRUE if the post exists.


Allows you to programatically update the total views count for a given post. Usage pvc_update_post_views( $post_id = 0, $post_views = 0 ); Parameters $post_id int required The post ID $post_views int required Post views number to be set for a given post ID. Return The function returns a bool value. FALSE if the post doesn’t exist; […]