- This topic has 16 replies, 4 voices, and was last updated 4 years, 3 months ago by
David.
-
AuthorPosts
-
February 11, 2019 at 5:06 am #807209
Manish
I need to remove the Excerpts totally from the archive page. Setting the excerpt length to 0 is not helping.
I also need to add the excerpt below the title on individual posts.
Please guide how to achieve this.
February 11, 2019 at 9:07 am #807502Tom
Lead DeveloperLead DeveloperHi there,
Setting the excerpt word count to 0 should do the trick: https://www.screencast.com/t/6qBYmlSJi
Is that not happening for you?
To add the excerpt below the title on individual posts, you can:
1. Create a Hook Element: https://docs.generatepress.com/article/hooks-element-overview/
2. Add this to the content:<?php the_excerpt(); ?>
3. Set the hook to
generate_after_entry_title
4. Check the Execute PHP checkbox.
5. Set the Display Rules to all single posts.
February 12, 2019 at 2:22 am #808090Manish
Thanks,
Adding the excerpt to single post worked fine.
But setting the ‘Excerpt word count’ to 0 has no effect.
February 12, 2019 at 9:36 am #808529Leo
StaffCustomer SupportAny chance you can link us to the page in question so we can try to see why that option isn’t working?
I just tried it too and it worked as Tom showed.
You can edit the original topic and use the private URL field.
Let us know 🙂
February 12, 2019 at 11:20 pm #808942Manish
Have added the url.
These are the current blog settings.
Site is still in development so no cache plugin is active at present.February 13, 2019 at 7:35 am #809418David
StaffCustomer SupportHi there,
are you using the Manual Excerpt meta box to add the excerpt?
February 15, 2019 at 1:10 am #811023Manish
YES, the standard way to add excerpts.
February 15, 2019 at 6:04 am #811193David
StaffCustomer SupportThe Blog settings excerpt length only apply to the auto excerpt that WP generates, not for manual excerpts and read mores as their length is user defined.
The simplest way would be to use some CSS to hide them from the archive:
.archive .entry-summary { display: none; }
February 15, 2019 at 6:11 am #811201Manish
Any other way?
This display:none method is not good for SEO. Can backfire with so much text hidden on category/archive pages.February 15, 2019 at 6:35 am #811220David
StaffCustomer SupportCould give this PHP snippet a try:
add_filter( 'wp_trim_excerpt', 'db_excerpt_metabox_remove' ); function db_excerpt_metabox_remove( $excerpt ) { $output = $excerpt; if ( is_archive() && has_excerpt() ) { $output = ''; } return $output; }
February 15, 2019 at 6:46 am #811225Manish
This works but leaves a large padding below the title. How to fix it?
February 15, 2019 at 6:49 am #811345David
StaffCustomer SupportThis method still outputs the entry summary container. So use the CSS i provided before to remove that from display.
February 16, 2019 at 3:22 am #811846Manish
Works perfectly!
Many thanks for the fantastic support you guys offer.February 16, 2019 at 6:12 am #811888David
StaffCustomer SupportGlad we could be of help.
February 20, 2019 at 12:16 am #815180Manish
add_filter( 'wp_trim_excerpt', 'db_excerpt_metabox_remove' ); function db_excerpt_metabox_remove( $excerpt ) { $output = $excerpt; if ( is_archive && has_excerpt() ) { $output = ''; } return $output; }
I am not sure why but this code removes the excerpts not just from the archive page/category page but also from the single post which we added using the generate_after_entry_title hook.
-
AuthorPosts
- You must be logged in to reply to this topic.