Support » Plugin: Rich Text Excerpts » “Read more…” link disappears when RTE is used

  • Resolved stephcthomp

    (@stephcthomp)


    Hi

    I have just installed Rich Text Excerpts (thank you) and it looks very promising.

    However, with my first experiment creating an excerpt using RTE, the “Read more…” link disappeared.

    Is this to be expected, meaning I will have to re-create this link manually for every post? Or is it an error of some kind?

    This is the site I want to use it on: https://shrinkwrap.blog/
    (Uses Generate Press theme.)

    Thank you 🙂

    • This topic was modified 2 years, 10 months ago by stephcthomp.
Viewing 1 replies (of 1 total)
  • Plugin Author bjorsq

    (@bjorsq)

    Hi – this isn’t the expected outcome of using the plugin, but then all the plugin does is allow you to format excerpts using a rich text editor. The display of the excerpt on your site is dependent on your theme. GeneratePress calls the_excerpt(), but unfortunately this does not add the read more link to manual excerpts. What you will need to do is use GPHooks (if you have GeneratePress Premium) or a child theme/plugin to add the following filter:

    
    add_filter('wp_trim_excerpt', 'add_read_more_to_manual_excerpt', 10, 2);
    function add_read_more_to_manual_excerpt( $trimmed, $formatted )
    {
        $excerpt_more = apply_filters( 'excerpt_more', ' ' . '[…]' );
        return $formatted . '<p>' . $excerpt_more . '</p>';
    }
    

    The filter wp_trim_excerpt is called by the wordpress function of the same name, and is fed a trimmed version of the excerpt and the contents of $post->post_excerpt (which is your formatted text). The function itself will only provide and excerpt with read more link if no manual excerpt is present. Adding this filter will add $excerpt_more in a paragraph tag to the end of your manual excerpts.

Viewing 1 replies (of 1 total)
  • The topic ‘“Read more…” link disappears when RTE is used’ is closed to new replies.