How to Enable Shortcodes in Widgets for WordPress
Shortcodes make life easier for any WordPress blogger. I can easily list subpages, add post meta elements, and even query posts using shortcodes. You can do as much in your widgets too, you just need a quick fix to enable shortcodes in your widgets.
To enable shortcodes in your widgets you can use the PHP code below:
Just add this code to
functions.php in your theme folder. This way you can easily use your theme/plugin shortcodes on your widgets. For example, if you are using my Adsense Widget, you could easily add a square ad to your sidebar using:
Or you could list subpages of a page using:
[subpages exceptme="true" childof="253"]
I hope you liked this quick tutorial. Enjoy.
Deal Notice: We are using A2 hosting for all of our websites, and we are really happy with their service. So we wanted to share you this discount link for you to try it out. If you get a hosting using this link, you will also help us build better content for you: SSD Hosting - 300% Faster Than Standard Hard Drives