jeudi 26 février 2015

Word limit in post_content after more tag


I am using the following code to hide the teaser and show content only after more tag in loop:



<?php
$after_more = explode(
'<!--more-->',
$post->post_content
);
if( $after_more[1] ) {
echo $after_more[1];
} else {
echo $after_more[0];
}
?>


Is there anyway to show only first 50 words instead of entire post content? I want to hide teaser and show 50 words after tag.





Aucun commentaire:

Enregistrer un commentaire