List category posts
Suggestion: Improving string cut when building excerpts (2 posts)

  1. Andrey Kiselev
    Posted 3 years ago #

    Hello, Fernando!
    Thanks for the grat plugin!
    Just one suggestion to improve it a little bit. When you build excerps you cut strings exactly at 252-nd char. This results in showing "black-diamond-question-mark" sometimes when cutting cyrillic strings. In order to work this out, you can cut string at a nearest space.

    So, this is your original string (CatList.php):

    $lcp_excerpt = substr($lcp_excerpt, 0, 252) . '...';

    And my suggestion is to replace it with this one:

    $lcp_excerpt = substr( $lcp_excerpt, 0, strrpos( substr( $lcp_excerpt, 0, 252 ), ' ' ) ) . '...';

    So, it just cuts excerpt at the nearest space before 252nd char.


  2. Andrey Kiselev
    Posted 3 years ago #

    The bug is still here. I just want to share a link illusttating how does it look like:


    Could you please include the fix in the next release?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • List category posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic