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 thought on “Limit WordPress Post or Page Content

Leave a Reply