How to create a shortcode to replace classic widget

[ad_1]

Hi @itiketinifaktai,

Looks like you’re using the Tiles theme with your popular posts list so please follow these instructions:

#1 Add a Custom HTML widget to your sidebar.

#2 Paste the following shortcode inside the Custom HTML widget:

[wpp range="last24hours" limit=3 stats_views=0 stats_category=1 thumbnail_width=320 thumbnail_height=160 wpp_start="<ul class="wpp-list wpp-tiles">" post_html="<li class="{current_class}">{thumb}<div class="wpp-post-data">{taxonomy} {title}</div></li>" wpp_end='</ul>']

The only parameter that you may want to adjust in there is the range parameter. It’s the equivalent to the Time Range dropdown from the classic widget. Possible values are: last24hours, last7days, last30days, all, custom (see Parameters for more details).

#3 Add these CSS rules to your site (eg. via WP Dashboard > Appearance > Customize > Additional CSS) in order for the shortcode to be styled as the Tiles theme.

#4 Add this line of code to your site, either via your theme’s functions.php or by using a plugin such as Code Snippets for example:

add_filter( 'widget_text', 'do_shortcode');

If you have any further questions please let me know.

Thank you @hcabrera I made it. Its work fine and no error anymore. And now like i understand we can work in future without problems? 🙂

Yep, that’s correct. Your popular posts list will continue to work for as long as possible 🙂

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer