Get the post content text only

PHP
<?php
function getContentText($content,$num=150){
	$content = apply_filters('the_content', $content);
	$content = preg_replace('/(<)([img])(\w+)([^>]*>)/', "", $content);
	$content = str_replace(']]>', ']]&gt;', $content);
	$content = wp_strip_all_tags($content);
	$content = preg_replace("/\s+\r/is", "\n", $content);
	$content = preg_replace("/\s+\r\n/is", "\n", $content);
	$content = preg_replace("/\s+\n/is", "\n", $content);
	$content = str_replace("\n",'',$content);
	$content = mySubstr($content,$num).'...';
	return $content;
}

Tags: