Using the WPP Shortcode and WordPress Popular Posts Block

The WPP shortcode (and WordPress Popular Posts Block) can be inserted into posts, pages, or any block of the WordPress CMS using only a few short characters of code. With this shortcode you can specify a range of parameters to achieve a wide variety of ‘Most Popular…’ or ‘Best Of…’ type lists to display on any block of your site.

WPP shortcode and the WPP Block has replaced the now-discontinued classic WordPress Popular Posts widget.

WordPress Popular Posts Block

WordPress Blocks is a new development of WordPress that allows you to add a greater range of functionality in the content of your site using the WordPress Block Editor, with almost zero technical coding knowledge required. An excellent advancement for the non-coding WordPress user, once you get a hang of the new Block Editor.

The WordPress Popular Posts block replaced the classic WordPress Popular Posts widget. It carries all of the same functionality, like specifying the number of your most popular posts to display, from which categories, and over what time frame their popularity is determined (the last 7 days, the last month, all-time, or a custom range of your choosing).

The main difference is that the WPP block can now be easily inserted into posts and pages, in addition to the sidebar, footer, after/before post widget areas, and so on, whereas the classic WordPress Popular Posts widget was localized only to widget areas. This significantly extends the customization potential of your sites content. You can easily include a list of your most popular content on your home page, archive pages, custom landing pages, or within a post itself to easily direct visitors to your best content.

You can learn more about the WordPress Block Editor here.

The WPP Shortcode

The WPP shortcode enables you to insert a list of your most popular content in any block on your site. You can create a page that highlights your all-time best content, according to views, or insert WPP shortcode into a post to show what has been trending over the last 24 hours.

Shortcodes are small bits of code that allow you to easily insert predetermined functionalities into content areas on your WordPress site. These are macro codes — small pieces of code that trigger an automated series of commands and instructions — so that you only need to write a single line of code, with a few words and parameters specified (which you will learn below) to call up aspects of the more detailed commands and instructions.

If you are using the (Gutenberg) Block Editor, you use the Shortcode Block to insert the [wpp] shortcode. (literally just type ‘[wpp]’ into the block, and you are done, at the default level at least). By default the [wpp] shortcode will display the 10 most popular posts within the last 24 hours, with a view count appearing beside.

However, you can add your own parameters to customize the WPP shortcode to display whatever you want.

In the following examples of we will explore the main parameters. For a full list of the available parameters, visit this full list of parameters.

Examples of the WPP Shortcode

[wpp range=’all’ limit=12] will display a list of the top twelve (limit=12) of your most popular posts of all-time (range=’all’).

[wpp range=’last24hours’ limit=5 stats_view=0] will display the 5 most popular posts within the last 24 hours, and will not displays the number of views of each posts (stats_view=0) since the default is set to display the views of each post beside the post title (default is essentially stats_view=1).

[wpp range=’last7days’ category=’Computer Science’] will display a list of the most popular posts over the last 7 days (range=’last7days’), it will show the number of views of those posts (since even though I did not specify, the default is set to display views, stats_view=1), and it will specify the categories that I chose (i.e. Computer Science, which on Projeda Tech includes within it Web Design articles, Front-End Development, and so on). If you want more categories, just separate each category of your choice with a semicolon (;) within the quotation marks as such: category=’cat1; cat2; cat3′ and so on.

[wpp range=’all’ limit=20 category=’Physics’ header=’Best Physics Articles of All Time!’ header_start='<h2>’ header_end='</h2>’ stats_view=0] This WPP shortcode will show a list of the top 20 physics articles of all time. There will be no view count. I also specified a header (‘Best Physics Articles of All Time!’) wrapped in <h2> tags.

To use any of the above parameters, just copy and past the highlighted shortcode into a Shortcode Block in the Block Editor, in the Sidebar, in one of the Footer widget areas, and you are done. Again, there are many more parameters that we can specify to get the precise functionality that we desire. We can display the post image thumbnail, an excerpt from the post of a specified length, the author and/or date, and much more.

See the full list of parameters for all possibilities.

Further Reading

Cite This Article

MLA

West, Brandon. "Using the WPP Shortcode and WordPress Popular Posts Block". Projeda, October 11, 2023, https://www.projeda.com/wpp-shortcode-wordpress-popular-posts-block/. Accessed May 2, 2025.

  • Categories