Is there a way to enable shortcodes in text saved in the customizer and retrieved using get_theme_mod?
I'm guessing there's a filter in a similar manner to enabling shortcodes in widgets.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityIs there a way to enable shortcodes in text saved in the customizer and retrieved using get_theme_mod?
I'm guessing there's a filter in a similar manner to enabling shortcodes in widgets.
To enable shortcodes in text widgets add a filter like that:
add_filter( 'widget_text', 'do_shortcode' );
You can pass every string to do_shortcode()
including get_theme_mod()
calls.
echo do_shortcode( get_theme_mod( 'theme_setting' ) );
theme_setting
with the name of your "about us" text setting.
Apr 27, 2016 at 14:55
get_theme_mod()
, that's why I gave you that example.
Apr 27, 2016 at 14:56