Hello,
When i click to category there is displayed complete first post, then complete second, etc...
I want to make that in category is displayed only title and then i few lines like 4 lines only of post? How can do that and where to look to change? The complete post must be displayed only when I click on post title.
Best Regars
Hey Boris,
Here is an example code snippet to add to your child theme functions.php
:
add_filter( 'the_content', 'example_category_truncated_content' );
function example_category_truncated_content( $content ) {
// Only truncate for category view.
if ( is_category() ) {
// Return truncated content and readmore.
return '<p>' . wp_trim_words( $content, 40, '...' ) . '</p><p>' . beans_post_more_link() . '</p>';
}
return $content;
}
You will notice that there is a check in the function that check if we are view a category, you may change that you apply to other views too. You will also see that I added the Read More link after the turncated content, you may remove that if you don't want it 🙂
Have fun,
Thankyou.