[Support request] Show full text on category A posts but only excerpts on category B posts

Home Forums Support [Support request] Show full text on category A posts but only excerpts on category B posts

Home Forums Support Show full text on category A posts but only excerpts on category B posts

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1146452
    Philipp

    Is it possible to show full posts on certain categories while only showing excerpts on another category?

    As an example, on my site, I’d like to show excerpts for the Sleep Music News category posts. But I want to show full text posts on all other categories because the full posts on the other categories are very short and more product presentations than long articles.

    Would be great to realise that. I have premium.

    Thank you!

    #1146464
    Leo
    Staff
    Customer Support

    Hi there,

    You should be able to use this filter:
    https://docs.generatepress.com/article/generate_show_excerpt/

    With this conditional tag:
    https://codex.wordpress.org/Conditional_Tags

    Let us know if you need help with the code πŸ™‚

    #1147153
    Philipp

    Hi Leo, Thanks for the pointer. Wow, I think it actually works (I’m kind of proud on myself πŸ™‚ I added this to the snippets plug in. Is that correct?

    add_filter( 'generate_show_excerpt','pp_sleep_music_news_category' );
    function pp_sleep_music_news_category( $show_excerpt )
    {
        if ( is_category( 'Sleep Music News' ))
    		return true;
    	
    	return $show_excerpt;
    }
    #1147511
    Leo
    Staff
    Customer Support

    Yup that looks good πŸ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.