Skip to content

Instantly share code, notes, and snippets.

@jz5
Created February 1, 2015 16:12
Show Gist options
  • Save jz5/de39d526f6e3eacc0bfa to your computer and use it in GitHub Desktop.
Save jz5/de39d526f6e3eacc0bfa to your computer and use it in GitHub Desktop.
function twcm_get_description()
{
global $post;
$twcm_options=twcm_get_options();
//$desc=trim(get_the_excerpt());
//if($desc=="")
//{
//$desc=$post->post_content;
$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=get_the_content();
//}
$desc=strip_tags( $desc );
//$desc=wp_filter_nohtml_kses( $desc ); #smililar with strip_tags() function
$desc=esc_attr($desc);
//$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