Skip to content

Instantly share code, notes, and snippets.

@carasmo
Last active January 19, 2017 20:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carasmo/16a45d305ad52c6e09c06c44288d93b7 to your computer and use it in GitHub Desktop.
Save carasmo/16a45d305ad52c6e09c06c44288d93b7 to your computer and use it in GitHub Desktop.
Genesis Only: allow shortcodes and autoembed in Genesis Archive Intro Text output.
<?php
//do not add if it's already at the top of your page
// don't add the 'shorcode-support-archive-intro-text.php' one, this covers both.
/**
*
* Add shortcode and autoembed support to Archive Intro Text
* change yourprefix_ in two locations
*
*/
function yourprefix_embed_shortcode_archive_intro_text() {
global $wp_embed;
//* Allow shortcodes and embeds on Genesis Archive Intro Text Tags and Categories
if ( is_category() || is_tag() || is_tax() ) {
add_filter( 'genesis_term_intro_text_output', array( $wp_embed, 'autoembed' ) );
add_filter( 'genesis_term_intro_text_output', 'do_shortcode' );
} //* endif term
if ( is_post_type_archive() && genesis_has_post_type_archive_support() ) {
add_filter( 'genesis_cpt_archive_intro_text_output', array( $wp_embed, 'autoembed') );
add_filter( 'genesis_cpt_archive_intro_text_output', 'do_shortcode' );
} //* endif cpt
//* Allow shortcodes and embeds on Genesis Author Intro Text
if ( is_author() ) {
add_filter( 'genesis_author_intro_text_output', array( $wp_embed, 'autoembed') );
add_filter( 'genesis_author_intro_text_output', 'do_shortcode' );
} //* endif author
}
add_action( 'genesis_before', 'yourprefix_embed_shortcode_archive_intro_text' );
<?php
//do not add if it's already at the top of your page
//* Allow shortcode on Genesis Archive Intro Text Tags and Categories
add_filter( 'genesis_term_intro_text_output', 'do_shortcode' );
//* Allow shortcode on Genesis Author Intro Text
add_filter( 'genesis_author_intro_text_output', 'do_shortcode' );
//* Allow shortcode on Genesis CPT ie: ('supports' => array( 'genesis-cpt-archives-settings' )
add_filter( 'genesis_cpt_archive_intro_text_output', 'do_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment