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 = array(), $display = true );

Parameters

$args array required

Array of optional arguments.

$display bool

Return or echo the markup. Defaults to TRUE.

Return

The function returns an HTML markup that contains a list the five most viewed posts ordered by total views