Wednesday, September 19, 2012

Set limit no. of character in post content in wordpress

wp-includes/post-template.php


function the_content($more_link_text = null, $stripteaser = false) {
    $content = get_the_content($more_link_text, $stripteaser);
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]>', $content);
    if($_GET['p'])
    {
    echo $content;
    }
    else
    {
    $position=200; // Define how many character you want to display.


$post = substr($content, 0, $position);

echo $post;
echo "....";
$url=get_permalink( $id );
echo "<br/><a href=".$url.">Read More</a>";
    }//
}

No comments:

Post a Comment

Thank you for your Comment....

Popular Posts