Parse Genesis Excerpts

Community Forums Forums General Discussion Parse Genesis Excerpts

This topic is: not resolved

Tagged: ,

This topic contains 6 replies, has 3 voices, and was last updated by  simbasounds 3 months, 2 weeks ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #114225

    simbasounds
    Member
    Post count: 20

    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?

    #114227

    genwrock
    Member
    Post count: 739

    Add 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


    See My PRO Genesis Child Themes | Need Genesis Developer? | Follow Me on Twitter

    #114237

    simbasounds
    Member
    Post count: 20

    Thanks 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.

    • This reply was modified 3 months, 2 weeks ago by  simbasounds.
    • This reply was modified 3 months, 2 weeks ago by  simbasounds.
    #114242

    simbasounds
    Member
    Post count: 20

    I’m still open to suggestions : )

    #114250

    genwrock
    Member
    Post count: 739

    Ok. 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 file

    NOTE: Do not modify the core and Genesis Framework. You will write the code in your child theme file

    Best of Luck.

    Chinmoy


    See My PRO Genesis Child Themes | Need Genesis Developer? | Follow Me on Twitter

    #114251

    Summer
    Participant
    Post count: 1112

    There’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.


    #114257

    simbasounds
    Member
    Post count: 20

    Normally 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!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.