Created
December 26, 2017 11:36
-
-
Save salvatorecapolupo/1110827e6dfd062a6bac5cbf8c9819ff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
With the following parameters you can customize the popular posts list when using either the wpp_get_mostpopular() template tag or the [wpp] shortcode. | |
Parameter What it does Possible values Defaults to Example | |
header Sets a heading for the list Text string None With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'header' => 'Popular Posts' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp header='Popular Posts'] | |
header_start Set the opening tag for the heading of the list Text string <h2> With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'header' => 'Popular Posts', | |
'header_start' => '<h3 class="title">', | |
'header_end' => '</h3>' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp header='Popular Posts' header_start='<h3 class="title">' header_end='</h3>'] | |
header_end Set the closing tag for the heading of the list Text string </h2> With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'header' => 'Popular Posts', | |
'header_start' => '<h3 class="title">', | |
'header_end' => '</h3>' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp header='Popular Posts' header_start='<h3 class="title">' header_end='</h3>'] | |
limit Sets the maximum number of popular posts to be shown on the listing Positive integer 10 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'limit' => 5 | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp limit=5] | |
range Tells WordPress Popular Posts to retrieve the most popular entries within the time range specified by you "last24hours", "last7days", "last30days", "all", "custom" last24hours With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'range' => 'last7days' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp range='last7days'] | |
time_quantity Especifies the number of time units of the custom time range Positive integer 24 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'range' => 'custom', | |
'time_quantity' => 1, | |
'time_unit' => 'hour' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp range='custom' time_quantity=1 time_unit='hour'] | |
time_unit Especifies the time unit of the custom time range minute, hour, day, week, month hour With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'range' => 'custom', | |
'time_quantity' => 1, | |
'time_unit' => 'hour' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp range='custom' time_quantity=1 time_unit='hour'] | |
freshness Tells WordPress Popular Posts to retrieve the most popular entries published within the time range specified by you 1 (true), 0 (false) 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'range' => 'weekly', | |
'freshness' => 1 | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp range='last7days' freshness=1] | |
order_by Sets the sorting option of the popular posts "comments", "views", "avg" (for average views per day) views With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'order_by' => 'comments' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp order_by='comments'] | |
post_type Defines the type of posts to show on the listing Text string post,page With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'post_type' => 'post,page,your-custom-post-type' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp post_type='post,page,your-custom-post-type'] | |
pid If set, WordPress Popular Posts will exclude the specified post(s) ID(s) form the listing. Text string None With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'pid' => '60,25,31' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp pid='60,25,31'] | |
cat If set, WordPress Popular Posts will retrieve all entries that belong to the specified category ID(s). If a minus sign is used, entries associated to the category will be excluded instead. Text string None With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'cat' => '1,55,-74' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp cat='1,55,-74'] | |
taxonomy If set, WordPress Popular Posts will filter posts by a given taxonomy. Text string None With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'taxonomy' => 'post_tag', | |
'term_id' => '118,75,15' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp taxonomy='post_tag' term_id='118,75,15'] | |
term_id If set, WordPress Popular Posts will retrieve all entries that belong to the specified term ID(s). If a minus sign is used, entries associated to the term(s) will be excluded instead. Text string None With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'taxonomy' => 'post_tag', | |
'term_id' => '118,75,15' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp taxonomy='post_tag' term_id='118,75,15'] | |
author If set, WordPress Popular Posts will retrieve all entries created by specified author(s) ID(s). Text string None With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'author' => '75,8,120' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp author='75,8,120'] | |
title_length If set, WordPress Popular Posts will shorten each post title to "n" characters whenever possible Positive integer 25 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'title_length' => 25 | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp title_length=25] | |
title_by_words If set to 1, WordPress Popular Posts will shorten each post title to "n" words instead of characters 1 (true), (0) false 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'title_by_words' => 1, | |
'title_length' => 25 | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp title_by_words=1 title_length=25] | |
excerpt_length If set, WordPress Popular Posts will build and include an excerpt of "n" characters long from the content of each post listed as popular Positive integer 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'excerpt_length' => 55, | |
'post_html' => '<li>{thumb} {title} <span class="wpp-excerpt">{summary}</span></li>' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp excerpt_length=25 post_html='<li>{thumb} {title} <span class="wpp-excerpt">{summary}</span></li>'] | |
excerpt_format If set, WordPress Popular Posts will maintaing all styling tags (strong, italic, etc) and hyperlinks found in the excerpt 1 (true), (0) false 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'excerpt_format' => 1, | |
'excerpt_length' => 55, | |
'post_html' => '<li>{thumb} {title} <span class="wpp-excerpt">{summary}</span></li>' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp excerpt_format=1 excerpt_length=25 post_html='<li>{thumb} {title} <span class="wpp-excerpt">{summary}</span></li>'] | |
excerpt_by_words If set to 1, WordPress Popular Posts will shorten the excerpt to "n" words instead of characters 1 (true), (0) false 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'excerpt_by_words' => 1, | |
'excerpt_length' => 55, | |
'post_html' => '<li>{thumb} {title} <span class="wpp-excerpt">{summary}</span></li>' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp excerpt_by_words=1 excerpt_length=55 post_html='<li>{thumb} {title} <span class="wpp-excerpt">{summary}</span></li>'] | |
thumbnail_width If set, and if your current server configuration allows it, you will be able to display thumbnails of your posts. This attribute sets the width for thumbnails Positive integer 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'thumbnail_width' => 30, | |
'thumbnail_height' => 30 | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp thumbnail_width=30 thumbnail_height=30] | |
thumbnail_height If set, and if your current server configuration allows it, you will be able to display thumbnails of your posts. This attribute sets the height for thumbnails Positive integer 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'thumbnail_width' => 30, | |
'thumbnail_height' => 30 | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp thumbnail_width=30 thumbnail_height=30] | |
rating If set, and if the WP-PostRatings plugin is installed and enabled on your blog, WordPress Popular Posts will show how your visitors are rating your entries 1 (true), (0) false 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'rating' => 1, | |
'post_html' => '<li>{thumb} {title} {rating}</li>' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp rating=1 post_html='<li>{thumb} {title} {rating}</li>'] | |
stats_comments If set, WordPress Popular Posts will show how many comments each popular post has got during the specified time range 1 (true), 0 (false) 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'stats_comments' => 1 | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp stats_comments=1] | |
stats_views If set, WordPress Popular Posts will show how many views each popular post has got during the specified time range 1 (true), (0) false 1 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'stats_views' => 0 | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp stats_views=0] | |
stats_author If set, WordPress Popular Posts will show who published each popular post on the list 1 (true), (0) false 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'stats_author' => 1 | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp stats_author=1] | |
stats_date If set, WordPress Popular Posts will display the date when each popular post on the list was published 1 (true), (0) false 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'stats_date' => 1 | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp stats_date=1] | |
stats_date_format Sets the date format Text string 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'stats_date' => 1, | |
'stats_date_format' => 'F j, Y' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp stats_date=1 stats_date_format='F j, Y'] | |
stats_category If set, WordPress Popular Posts will display the categories associated to each entry 1 (true), (0) false 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'stats_category' => 1, | |
'post_html' => '<li>{thumb} <a href="{url}">{text_title}</a> {category}</li>' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp stats_taxonomy=1 post_html='<li>{thumb} <a href="{url}">{text_title}</a> {category}</li>'] | |
stats_taxonomy If set, WordPress Popular Posts will display the taxonomies associated to each entry 1 (true), (0) false 0 With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'stats_taxonomy' => 1, | |
'post_html' => '<li>{thumb} <a href="{url}">{text_title}</a> {taxonomy}</li>' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp stats_taxonomy=1 post_html='<li>{thumb} <a href="{url}">{text_title}</a> {taxonomy}</li>'] | |
wpp_start Sets the opening tag for the listing Text string <ul> With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'wpp_start' => '<ol>', | |
'wpp_end' => '</ol>' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp wpp_start='<ol>' wpp_end='</ol>'] | |
wpp_end Sets the closing tag for the listing Text string </ul> With wpp_get_mostpopular(): | |
<?php | |
$args = array( | |
'wpp_start' => '<ol>', | |
'wpp_end' => '</ol>' | |
); | |
wpp_get_mostpopular( $args ); | |
?> | |
With the [wpp] shortcode: | |
[wpp wpp_start='<ol>' wpp_end='</ol>'] | |
post_html Sets the HTML structure of each post Text string, custom HTML. | |
Available Content Tags: | |
{thumb} (returns thumbnail linked to post/page, requires thumbnail_width & thumbnail_height) | |
{thumb_img} (returns thumbnail image without linking to post/page, requires thumbnail_width & thumbnail_height) | |
{thumb_url} (returns thumbnail url, requires thumbnail_width & thumbnail_height) | |
{title} (returns linked post/page title) | |
{pid} (returns the post/page ID) | |
{summary} (returns post/page excerpt, and requires excerpt_length to be greater than 0) | |
{stats} (returns the default stats tags) | |
{rating} (returns post/page current rating, requires WP-PostRatings installed and enabled) | |
{score} (returns post/page current rating as an integer, requires WP-PostRatings installed and enabled) | |
{url} (returns the URL of the post/page) | |
{text_title} (returns post/page title, no link) | |
{author} (returns linked author name, requires stats_author=1) | |
{category} (returns linked category name, requires stats_category=1) | |
{taxonomy} (returns linked taxonomy names, requires stats_taxonomy=1) | |
{views} (returns views count only, no text) | |
{comments} (returns comments count only, no text, requires stats_comments=1) | |
{date} (returns post/page date, requires stats_date=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment