[Resolved] Manual excerpt is ignored

Home Forums Support [Resolved] Manual excerpt is ignored

Home Forums Support Manual excerpt is ignored

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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.

    #991945
    David
    Staff
    Customer Support

    Hi 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.

    #991951
    Alexander

    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.

    #992196
    David
    Staff
    Customer Support

    I 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.

    #992398
    Jeremy

    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!

    #992403
    Tom
    Lead Developer
    Lead Developer

    We 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.

    #992490
    Alexander

    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.

    #992491
    Alexander

    PS: now we just need to same filters for WP Show Posts… ๐Ÿ˜‰

    #992548
    Tom
    Lead Developer
    Lead Developer

    Awesome, glad it’s working! ๐Ÿ™‚

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.