Archived topic
Show the excerpt for every categories but one
7 replies · Started by Suresh on August 11, 2020
Hi,
I am trying to add a filter (as suggested on this post: https://generatepress.com/forums/topic/full-length-posts-for-1-category-else-excerpt-only/).
I am using the following code within the "Code snippet" plugin as php:
add_filter( 'generate_show_excerpt','tu_full_post_photos' );
function tu_full_post_photos( $show_excerpt ) {
if ( is_category( 'Deals' ) ) {
return false;
}
return $show_excerpt;
}
I am not sure why is not working, am I doing anything wrong?
Hi there,
Can you link me to the deals category page?
The page you've linked is just the default posts page.
I haven't any page dedicated for just the deals category. I have added the link to the first post with one of the post that has category = deals.
Little confused.
The page you link now is a single post?
Sorry Leo, I think I'm making you crazy tonight :D
So basically I have two types of post categories, Deals and Guide. When I go to the default post page, I would like to have the "Deals" posts to show in full, but the "Guide" posts to show only the excerpts.
Does it make sense?
Hmm can you try if in_category works?
https://codex.wordpress.org/Conditional_Tags#A_Category_Page
Thank you Leo, the in_category is working good!
No problem :)