How to Use Shortcodes in WordPress Sidebar Widgets

In past, PHP Tricks shown you how to CREATE SHORTCODE in WordPress. Next there is most searchable question is that How to use these shortcodes in WordPress sidebar widget. So Today PHP Tricks provide you way to do this in few minutes.

Why Shortcodes Does not work in Widget sidebar inside WP-ADMIN ??

When you add some shortcodes in sidebar widget and think this will execute then you are wrong. Actually WordPress filters execute widget content as simple text and you get shortcode itself as plain text instead final result.

 

 

Now there are two to easily enable shortcodes in sidebar widget.

Way 1 : Using WordPress Plugin

In this way, we will use simple WordPress plugin and you need to install and activate the Shortcode Widget plugin.
After activation, you need to go Appearance » Widgets page. There you will find a shortcode widget in the list of available widgets.

Way 2 : Using WordPress code

You can also enable shortcode functionality in sidebar widget by adding  following code in your functions.php file.

Above code enables to render shortcodes functionality inside sidebar widget.

 

From above both way, you will see your shortcode is now working at front website

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *