how to shorten the_content in wordpress

  • 0
  • <?php echo wp_trim_words( get_the_content(), 40, ‘…’ ); ?>
  • $last_space = strrpos( substr(get_the_excerpt(), 0, 216 ), ‘ ‘ );
    $cnt1 = substr(get_the_excerpt(),0,$last_space);

    echo $cnt1;

<?php echo wp_trim_words( get_the_content(), 40, ‘…’ ); ?> $last_space = strrpos( substr(get_the_excerpt(), 0, 216 ), ‘ ‘ ); $cnt1 = substr(get_the_excerpt(),0,$last_space); echo $cnt1;

<?php echo wp_trim_words( get_the_content(), 40, ‘…’ ); ?> $last_space = strrpos( substr(get_the_excerpt(), 0, 216 ), ‘ ‘ ); $cnt1 = substr(get_the_excerpt(),0,$last_space); echo $cnt1;