The content limit function for wordpress

function the_content_limit($max_char, $more_link_text = '(more...)'
$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) {
echo "";
echo $content;
echo "<a href=""the_permalink();</p> <p> 
     echo "">"."Read More</a>";
echo "";
}

elseif ((strlen($content)>$max_char) &&
 ($espacio = strpos($content, " ", $max_char ))) {
$content = substr($content, 0, $espacio);
$content = $content;
echo "
";
echo $content;
echo "...";
echo <a href="";echo the_permalink(); 
echo "">".$more_link_text."</a>";
echo "
";
}

else {
echo "
";
echo $content;
echo "<a href="";echo the_permalink();echo "">"."Read More</a>";
echo "";
}
}

0 comments:

Post a Comment