Skip to content

Instantly share code, notes, and snippets.

@chrdesigner
Created December 12, 2013 20:35
Show Gist options
  • Select an option

  • Save chrdesigner/7934971 to your computer and use it in GitHub Desktop.

Select an option

Save chrdesigner/7934971 to your computer and use it in GitHub Desktop.
<?php
global $post;
$trim_length = 450; //desired length of text to display
$summary_excerpt = 'wpcf-breve-descricao';
$value = get_post_meta($post->ID, $summary_excerpt, true);
if ($value != '') {
if(strlen($value) <= $trim_length){
echo apply_filters('breve-descricao', $value);
} else {
echo apply_filters('breve-descricao', rtrim(substr($value,0,$trim_length)).'...');
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment