Last active
August 29, 2015 14:07
-
-
Save deckerweb/b153eeb1274b4220a8e2 to your computer and use it in GitHub Desktop.
Enable Shortcode for Text Widgets in WordPress.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Do NOT include the opening php tag */ | |
add_action( 'init', 'ddw_add_shortcodes_for_text_widget', 1 ); | |
/** | |
* Enable Shortcodes for Text Widgets. | |
* | |
* @author David Decker - DECKERWEB | |
* @link http://daviddecker.io | |
* @link https://gist.github.com/deckerweb/b153eeb1274b4220a8e2 | |
*/ | |
function ddw_add_shortcodes_for_text_widget() { | |
/** Add shortcode support to widgets */ | |
if ( ! is_admin() ) { | |
add_filter( 'widget_text', 'do_shortcode' ); | |
} // end if | |
} // end function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment