One of our OSTraining members was having an issue with shortcodes in widgets, so we created a tutorial for her.
By default, WordPress doesn't execute shortcodes inside the default text widget. This tutorial will show you an easy way to get shortcodes working.
The image belows show the problem we face. We put a shortcode into a widget, but it shows up as plain text.
Let's install a plugin to fix this.
- Install and enable the Shortcode Widget plugin
- Go to Appearance > Widgets.
- You'll now see a new widget type called "Shortcode Widget".
- Add the Shortcode Widget to your sidebar:
- On the right side, you can now add your [shortcode] to your Shortcode Widget's content:
- Check your front-end and the shortcode will now. That's all there is to it. Enjoy!
Shortcode Pro Tip
You can execute shortcodes in the regular WordPress text widget by adding the following code to your functions.php file of your child theme: