Skip to content

Instantly share code, notes, and snippets.

@3200creative
Last active September 24, 2017 19:18
Show Gist options
  • Save 3200creative/08e9ef534163ed5c1842 to your computer and use it in GitHub Desktop.
Save 3200creative/08e9ef534163ed5c1842 to your computer and use it in GitHub Desktop.
Add shortcodes anywhere & everywhere!
add_action( 'init', 'shortcodes_anywhere' );
/**
* Run shortcodes and enable autoembed at Genesis archive intro text.
*/
function shortcodes_anywhere(){
/** Global $wp_embed */
global $wp_embed;
add_filter('widget_text', 'do_shortcode');
/** Taxonomy Intros */
add_filter( 'genesis_term_intro_text_output', 'do_shortcode' );
add_filter( 'genesis_term_intro_text_output', array( $wp_embed, 'run_shortcode'), 8 );
add_filter( 'genesis_term_intro_text_output', array( $wp_embed, 'autoembed'), 8 );
/** Archive Intro Text */
add_filter( 'genesis_author_intro_text_output', 'do_shortcode' );
add_filter( 'genesis_author_intro_text_output', array( $wp_embed, 'run_shortcode'), 8 );
add_filter( 'genesis_author_intro_text_output', array( $wp_embed, 'autoembed'), 8 );
/** Post Type Archive Intro Text */
add_filter( 'genesis_cpt_archive_intro_text_output', 'do_shortcode' );
add_filter( 'genesis_cpt_archive_intro_text_output', array( $wp_embed, 'run_shortcode'), 8 );
add_filter( 'genesis_cpt_archive_intro_text_output', array( $wp_embed, 'autoembed'), 8 );
}
@weslinda
Copy link

Thanks for posting this. Was hunting around how to figure this out and it worked perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment