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
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
’Best
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
- Using WPP on posts & pages. Héctor Cabrera. <www.github.com>. Accessed 11 Oct 2023.
- Template Tags. Héctor Cabrera. <www.github.com>. Accessed 11 Oct 2023.
Leave a Reply