Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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