Archived topic
Full length posts for 1 category, else excerpt only
5 replies · Started by arthur on October 25, 2018
Hi I want one specific category to include the full length of the post, while others would show the excerpt.
I found this article that tells how to do it, by altering the theme files:
https://premium.wpmudev.org/forums/topic/want-one-category-post-show-full-content-but-others-to-show-excerpts-in-loop
BUT, if there is a simple hook or something that will achieve the same thing, it seems it would make much more sense to just put in a few lines in functions.php in my child theme. As opposed to overriding the entire file for just one small change.
Any thoughts on how to achieve this?
Thanks!
Hi there,
Take a look at the first example here:
https://docs.generatepress.com/article/generate_show_excerpt/
The conditional tag you will need:
https://codex.wordpress.org/Conditional_Tags#A_Category_Page
Let me know if you need more info :)
Hey Leo, I tried this. But it doesn't seem to be working.....
add_filter( 'generate_show_excerpt','tu_full_post_photos' );
function tu_full_post_search( $show_excerpt ) {
if ( is_category('6') ) {
return false;
}
return $show_excerpt;
}
The function name has to match. Try this:
add_filter( 'generate_show_excerpt','tu_full_post_photos' );
function tu_full_post_photos( $show_excerpt ) {
if ( is_category('6') ) {
return false;
}
return $show_excerpt;
}
Let me know :)
Oh haha I know better than that thanks for catching my mistake.
No problem :)