Last active
September 24, 2017 19:18
-
-
Save 3200creative/08e9ef534163ed5c1842 to your computer and use it in GitHub Desktop.
Add shortcodes anywhere & everywhere!
This file contains hidden or 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
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 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for posting this. Was hunting around how to figure this out and it worked perfectly!