Excerpt in WordPress -9
the_excerpt () function is used in WordPress for article summary and WordPress post with a link to the whole content. In another way we can create our own customize function with button and permalink also and the code is given below:
//This function is used to get particular character
function get_excerpt($count)
{
$permalink = get_permalink($post->ID);
$excerpt = get_the_content();
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, $count);
$excerpt = substr($excerpt, 0, strripos($excerpt, ” “));
$excerpt = ‘<p>’ . $excerpt . ‘… </br><a href=”‘ . $permalink . ‘”>Read More >></a></p>’;
return $excerpt;
}
Now get_excerprt(50) is the user friendly function we can call anywhere by passing the number of character as parameter and do the css of button also.