I want to display a specific gallery (without a plugin = WordPress built-in gallery) inside a widget. I tried the shortcode [gallery ids="717"]
but that doesn't work. Maybe a workaround could be enabling shortcodes inside widgets? if yes, how do I do that?
1 Answer
Widgets don't usually allow shortcodes in them (they treat them as normal text).
What you have to do, is to tell this widget, it should run do_shortcode
on it's text. To do it, you can use this snippet:
add_filter('widget_text', 'do_shortcode');
Just place it in your function.php
file. Then you can place shortcodes in Text Widget and they will work normally.