<?php
/*************************************************************************/
function wp_limit_post($max_char, $more_link_text = '[...]',$notagp = false, $stripteaser = 0, $more_file = '') {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$content = strip_tags($content);
if (strlen($_GET['p']) > 0) {
if($notagp) {
echo substr($content,0,$max_char);
}
else {
echo '<p>';
echo substr($content,0,$max_char);
echo "</p>";
}
}
else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
$content = substr($content, 0, $espacio);
$content = $content;
if($notagp) {
echo substr($content,0,$max_char);
echo $more_link_text;
}
else {
echo '<p>';
echo substr($content,0,$max_char);
echo $more_link_text;
echo "</p>";
}
}
else {
if($notagp) {
echo substr($content,0,$max_char);
}
else {
echo '<p>';
echo substr($content,0,$max_char);
echo "</p>";
}
}
}
?>