function break_text($text, $length = 500){
if(strlen($text)<$length+10) return $text;//don't cut if too short
$break_pos = strpos($text, ' ', $length);//find next space after desired length
$visible = substr($text, 0, $break_pos);
return balanceTags($visible) . " […]";
} or with readmore
function limit_text($text){
if(is_front_page())
{
$length = 250;
if(strlen($text)<$length+10) return $text; //don't cut if too short
$break_pos = strpos($text, ' ', $length); //find next space after desired length
$visible = substr($text, 0, $break_pos);
return balanceTags($visible) . "... <a href='".get_permalink()."'>read more</a>";
}else{
return $text;
}
}
Adding or Including custom post type to default WordPress loop by altering the 'pre_get_posts' function.…
Limit the number of posts revisions that WordPress stores in the database. edit wp-config.php file…
In Multisite, List Recent Posts Across an Entire Network by using custom query or WP_Query…
code for the plugin file itself:- [crayon-6929ba3d99af3591830936/] I like to put this in the actual…
Switching the permalink structure from /year/month/post-slug to just /post-slug is easy by going to Settings…
[crayon-6929ba3d9a0d8627345130/]