Return to Snippet

Revision: 50483
at August 24, 2011 12:27 by tcelestino


Initial Code
function TruncateText ($str_text, $max_char) {
	if(strlen($str_text)>$max_char){
		return substr($str_text, 0, $max_char).'...';
	} else {
		return $str_text;
	}
}

Initial URL

                                

Initial Description
Usage:

<?php>post_excerpt; if($textin == ""){ $textin = $post->post_content; } echo TruncateText($textin, 150); ?>

Initial Title
Function excerpt to WordPress

Initial Tags
wordpress

Initial Language
PHP