Limit WordPress Post or Page Content

Copy this function and paste in the function.php
————
function dp_clean($excerpt, $substr=0) {
$string = strip_tags(str_replace(‘[…]‘, ‘…’, $excerpt));
if ($substr>0) {
$string = substr($string, 0, $substr);
}
return $string;
}

Call this function in your index.php
———–

< ?php echo dp_clean($post->post_content, 250); ? >

One Response to Limit WordPress Post or Page Content

  1. zenna says:

    Thanks for ur post.

Leave a Reply