<?php
//Custom content function with words manual limit
function content($limit, $postid, $showmorelink = true) { //Normally, the second parameter provided is '$post->ID'
	$content = explode(' ', get_post_field('post_content', $postid), $limit);
	if (count($content)>=$limit) {
		array_pop($content);
		$content = implode(" ",$content);
		$content = preg_replace('/\[.+\]/','', $content);
		$content = apply_filters('the_content', $content);
		$content = str_replace(']]>', ']]&gt;', $content);
		$content = strip_tags($content,'<br />');
		$content .= '&hellip;';
		if ($showmorelink) {$content .= ' <a class="more-link" href="'. get_permalink($postid) . '">Далее...</a>';}
	} else {
		$content = implode(" ",$content);
		$content = preg_replace('/\[.+\]/','', $content);
		$content = apply_filters('the_content', $content);
		$content = str_replace(']]>', ']]&gt;', $content);
	}
	return $content;
}
?>