- This topic has 8 replies, 4 voices, and was last updated 4 years, 3 months ago by
Tom.
-
AuthorPosts
-
August 23, 2019 at 2:07 pm #991888
Alexander
Hello,
I have a manual excerpt set for some posts and no matter what I do, GP doesn’t use those excerpts. In Layout -> Blog -> Archive, it doesn’t seem to matter whether I set “Full” or “Excerpt”, GP always shows either the first paragraph (to my “more” tag), or the full post.
Example post: https://www.alex-kunz.com/carlsbad-caverns/
Weblog where this post is first article right now: https://www.alex-kunz.com/weblog/
After doing some digging here, I changed the post type to “Standard” (from “Gallery”) but that didn’t change anything.
I emptied the server-side cache & the browser cache, tried different browsers, to no avail.
Thanks for any help
Alexander.August 23, 2019 at 5:58 pm #991945David
StaffCustomer SupportHi there,
the Excerpt length in the Customizer only applies to the automatic excerpt.
And there is a pecking order as to which excerpt is displayed ie.
Read More beats Manual Excerpt which beats Automatic Excerpt.So its just deciding which excerpt method you want to use.
August 23, 2019 at 6:25 pm #991951Alexander
Hello David,
I removed the “more” tag (and emptied caches) as well, but it doesn’t work. None of these constellations seems to actually use the manual excerpt on my site.
FWIW, I think it would be nice if there was a configuration option for the “pecking order”. I for one would always prefer the manual excerpt. If I take the extra time to write it, I’d like to see it used – but also not give up on the “Read more” option for those situations where I didn’t write one). It would combine the best of both worlds, instead of essentially leaving no choice.
Thanks!
Alexander.August 24, 2019 at 5:39 am #992196David
StaffCustomer SupportI thought i would double check the pecking order and that is correct.
I will pass this onto Tom he will know if there is a filter to change the pecking order.August 24, 2019 at 9:15 am #992398Jeremy
I don’t know if there is a filter to change the pecking order, but there is a filter to activate “Read More” when a manual excerpt is used.
Activating Read More with Custom Excerpt
The issue is that by default, WordPress skips all of the excerpt_length and excerpt_more filters when the custom excerpt is used. This filter checks to see if a manual excerpt has been entered, and if so outputs the excerpt with a Read More link.
Personally, I’d love to see this filter active by default in GP Premium. It seems to be the expected behavior to display the manual excerpt when one is entered.
There are also filters to change the HTML markup of your read more link inside your blog post excerpts, as well as when using the more tag.
I’ve placed all three of these filters in my functions.php on my development site. This way, whether I’m using the Read More, Manual, or Automatic excerpts, the excerpt and Read More link are styled the same. The only drawback is that the “Read More Label” and “Display read more as button” options in the customizer do not function. They are overridden by the filters.
Hope this helps!
August 24, 2019 at 9:24 am #992403Tom
Lead DeveloperLead DeveloperWe can tell GP to use the manual excerpt over the read more tag with a filter:
add_filter( 'generate_show_excerpt', function( $excerpt ) { if ( has_excerpt() ) { return true; } return $excerpt; } );
Thanks for your post, Thornbrand! I want to include the read more link/button with manual excerpts, but I’m afraid the change wouldn’t be so welcome to people who are used to the way it is now (or are adding their own buttons in). For example, people who are using the functions you linked to would end up with two read more buttons. I need to think of a good backward-compatible way to integrate this into an update.
August 24, 2019 at 12:15 pm #992490Alexander
Thanks Tom and Thornbrand for chiming in.
I used Tom’s filter in a code snippet to get the manual excerpt, and the code from Thornbrand’s post to get the Read More button to these posts – now it’s exactly how I’d like it to be.
Thank you both very much for your help, that was great!
Alexander.August 24, 2019 at 12:16 pm #992491Alexander
PS: now we just need to same filters for WP Show Posts… π
August 24, 2019 at 2:53 pm #992548Tom
Lead DeveloperLead DeveloperAwesome, glad it’s working! π
-
AuthorPosts
- You must be logged in to reply to this topic.