Site logo

[Support request] Excerpt limit to be character count instead of word count

Home Forums Support [Support request] Excerpt limit to be character count instead of word count

Home Forums Support Excerpt limit to be character count instead of word count

  • This topic has 3 replies, 2 voices, and was last updated 5 years ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1706231
    Patricia

    Hi there support,

    Currently we have setup the blog roll and with the use of WP Show Posts plugin. It was set to limit per word but the problem is, some words are lengthy.
    I am wondering how can I change the except limit from word count to character/letter count? The word count sometimes messes up with the height of the boxes and we wanted it to be the same height and aligned.

    https://newsite.antiagingninjas.com/blog/ https://prnt.sc/10tfosg

    thanks in advance for your help 🙂

    #1706336
    David
    Staff
    Customer Support

    Hi there,

    changing from word to character count is tricky – instead try adding this CSS:

    .wp-show-posts-columns#wpsp-19426 .wp-show-posts-inner {
      display: flex;
      flex-direction: column;
    }
    
    .wpsp-read-more {
      margin-top: auto;
    }

    It should align all Read More buttons.

    #1707760
    Patricia

    Hi David,

    thanks for your reply.

    thanks i will try this out.

    but just in case we really need to change it to word count, how can we do that.

    I know a bit of PHP so I think it’s worth the try. thankyou 🙂

    #1707853
    David
    Staff
    Customer Support

    You can try this snippet:

    add_filter( 'the_excerpt', function( $excerpt ) {
      $excerpt = substr( $excerpt, 0, 60 );
    
      return $excerpt;
    } );

    change the 60 to the number of characters you want displayed.

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