Community Forums › Forums › Archived Forums › Design Tips and Tricks › Allow shortcodes to work in Category Archive Intro Text
Tagged: shortcodes in category pages
- This topic has 13 replies, 5 voices, and was last updated 7 years, 2 months ago by carasmo.
-
AuthorPosts
-
March 19, 2015 at 11:04 am #144950SanJuanLiveMember
I am trying to get a shortcode to work in my category pages like this one: http://sanjuandelsur.org/san-juan-del-sur-activities/
I have added the following code to my functions.php file for my theme:
add_filter( 'term_description', 'shortcode_unautop');
add_filter( 'term_description', 'do_shortcode' );(I got this code from this post: http://stephanieleary.com/2010/02/using-shortcodes-everywhere/)
But unfortunately it does not work. I have researched for several hours but cant find a solution so I was hoping for some help here on the forum.
http://sanjuandelsur.org/san-juan-del-sur-activities/March 20, 2015 at 12:02 pm #145046SanJuanLiveMemberAny ideas anyone? It would make my day if someone helped me out here.
December 2, 2015 at 4:40 pm #172528formacct23Participantbump. i am searching for a solution to this exact problem too.
December 2, 2015 at 5:04 pm #172532carasmoParticipantThe original post appears to have had the concept incorrect behind what the tutorial she linked to accomplished.
I'm going to take a stab and guess that she wanted the category description to display on the category pages and that goal has nothing to do with shortcodes.
http://mygenesisthemes.com/category-description-genesis/
December 2, 2015 at 5:20 pm #172533carasmoParticipantSo the answer is (add to functions.php)
/* shows a category description that accepts shortcodes and html. */ function cab_category_description () { if (is_category() ) { echo do_shortcode( category_description( $category-id ) ); }} add_action( 'genesis_before_loop', 'cab_category_description'); remove_filter( 'pre_term_description', 'wp_filter_kses' );
December 2, 2015 at 7:04 pm #172543formacct23ParticipantThanks, carasmo, for the reply. Unfortunately, if this is to make shortcakes work in category intro texts, it didn't work.
December 2, 2015 at 7:05 pm #172544formacct23Participantsorry, meant shortcodes, not shortcakes... stupid autocorrect...
December 2, 2015 at 7:48 pm #172549formacct23Participantthis post got me really close but using this function, the shortcode executes BEFORE the intro text, whereas I want it to execute AFTER the intro text AND BEFORE the list of posts in the category. Or better, the shortcode should execute within the intro text wherever i've placed it.
doing a google search outside this forum, brad dalton wrote a post with 3 solutions to execute the shortcode within the intro text. however, this article requires a paid subscription to read the solution. since brad helps out here in this studiopress forum, i'm hoping brad can point me to a solution here.
i see that the Genesis Simple Hooks plugin allows shortcodes to be executed there, but I don't know where to put the shortcode that would make it execute AFTER the intro text BUT BEFORE the list of posts in a category page.
i've read multiple people requesting about this solution in these forums so a solution would be helpful to more than just me here.
please advise.
December 4, 2015 at 1:29 am #172693formacct23Participantbump
January 18, 2017 at 4:05 pm #199631limboMemberbump *please :)*
January 18, 2017 at 8:57 pm #199638Victor FontModeratorTry add_filter( 'category_description', 'do_shortcode' );. There is no WordPress filter for term_description. https://codex.wordpress.org/Plugin_API/Filter_Reference#Category_and_Term_Filters
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?January 19, 2017 at 12:47 pm #199678carasmoParticipantThe category description and the archive intro text. I think in December 15 I should have read the Title of the post instead of the first OP, which confused me. Category description and Archive Intro Text are different things and the latter is part of Genesis themes, the former is part of WordPress. I was significantly less familiar with Genesis in late 2015.
use Victor's post for getting the category_description() to allow shortcodes:
add_filter( 'category_description', 'do_shortcode' );
The filter for the Archive Intro Text is similar:
add_filter( 'genesis_term_intro_text_output', 'do_shortcode' );
This allows shortcodes on the Archive Intro Text.
January 19, 2017 at 12:59 pm #199685carasmoParticipantHere is shortcode support:
//* 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' );
January 19, 2017 at 2:03 pm #199693carasmoParticipantSee https://gist.github.com/carasmo/16a45d305ad52c6e09c06c44288d93b7
To add shortcode and autoembed support.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.