Skip to content

Instantly share code, notes, and snippets.

Created February 1, 2015 16:12
What would you like to do?
function twcm_get_description()
global $post;
$desc=strip_shortcodes( $post->post_content ); #avoid shortcode content
//$desc=apply_filters('the_content',$post->post_content);#using this method to keep shortcode gentrated texts.
$desc=strip_tags( $desc );
//$desc=wp_filter_nohtml_kses( $desc ); #smililar with strip_tags() function
//$desc = trim(preg_replace("/\s+/", " ", $desc)); #to maintain a space between words in description. Since version 1.1.2
$desc=twcm_sub_string($desc, 200);
return $desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment