1

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?

3

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.