Community Forums › Forums › Archived Forums › General Discussion › Parse Genesis Excerpts
Tagged: parse, shortcodes
- This topic has 6 replies, 3 voices, and was last updated 9 years, 8 months ago by simbasounds.
-
AuthorPosts
-
July 14, 2014 at 8:03 am #114225simbasoundsMember
I'm not sure if this is a Genesis question or a WordPress question, but here goes:
Is there a way to get truncated archive content (aka auto excerpts) - as set in Genesis Theme Settings - to parse as normal post content? Or else limit archive content, while retaining parsing?
If you choose Display Post Content and Limit content to 0 characters it will display ALL content from the posts in the archive, and parse shortcodes.
If you choose, for example, Limit content to 300 characters, then it does what it says it's going to do ie.
"Using this option will limit the text and strip all formatting from the text displayed", which means any shortcodes will not be processed.I need to limit my content, AND parse shortcodes.
(manual excerpts are not an option: it's an existing site with 100s of posts)Possible?
July 14, 2014 at 8:49 am #114227Genesis DeveloperMemberAdd the following code in your functions.php file
add_filter('the_content_limit', 'do_shortcode'); add_filter('the_content_limit', 'the_custom_content_limit'); function the_custom_content_limit($content){ return wpautop($content);}
Note: I did not test the code. So I am not 100% sure that it'll work or not
July 14, 2014 at 10:20 am #114237simbasoundsMemberThanks Genwrock,
It didn't work, but I think that may be on the right track. At least I know the filter for the_content_limit now.
And I'm understanding the problem better now:
With or without that code I couldn't see the actual shortcodes eg. [my_shortcode]
So they are being processed, but not rendered when content is being limited.The shortcode in question is for the Youtube Lyte plugin, but actually it's WordPress video URLs which are not being parsed. When I enter Youtube URLs in the text editor for a post, they show as videos on the post, but not in the archive with content limit on, where they show as unprocessed URL text.
July 14, 2014 at 11:00 am #114242simbasoundsMemberI'm still open to suggestions : )
July 14, 2014 at 11:27 am #114250Genesis DeveloperMemberOk. i checked this function get_the_content_limit . it is removing the shortcode so the content truncation count is done correctly . If you want shortcode then you need to modify the lot of code. First you need to disable the "genesis_do_post_content" hook using the conditional tag. Then you need to create a new function for post content and that function will allow the short code
You need to modify the following functions
1. genesis_do_post_content (this function is calling the the_content_limit() ) // structure/post.php file
2. get_the_content_limit (this function is calling from the_content_limit() function) //path is functions/formatting.php fileNOTE: Do not modify the core and Genesis Framework. You will write the code in your child theme file
Best of Luck.
Chinmoy
July 14, 2014 at 11:32 am #114251SummerMemberThere's a plugin called Advanced Excerpt that will enable or disable shortcodes in excerpts.
That's a newer addition to the plugin since I last used it (and I haven't used it in a long time but liked it when I did), but it looks like it might be an option for you to try out.
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkJuly 14, 2014 at 12:05 pm #114257simbasoundsMemberNormally I'd try the longer solution and learn something in the process, but I'm on a tight deadline so I went with Advanced Excerpt and it worked. Thanks so much Chinmoy and Summer!
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.