Skip to content

Instantly share code, notes, and snippets.

@jandrodev
Created May 29, 2015 12:17
Show Gist options
  • Save jandrodev/13c2428eb9b1c913f66d to your computer and use it in GitHub Desktop.
Save jandrodev/13c2428eb9b1c913f66d to your computer and use it in GitHub Desktop.
Recibe el contenido y el número de caracteres y corta ese contenido por ese número pasado.
/**
* Recibe el contenido y el número de caracteres y corta ese contenido por ese número pasado.
*
* @param $content
* @param $letter_count
*/
function cortar_contenido( $content , $letter_count ){
$striped_content = strip_shortcodes($content);
$striped_content = strip_tags($striped_content);
$excerpt = mb_substr($striped_content, 0, $letter_count );
if($striped_content > $excerpt){
$excerpt .= "...";
}
echo $excerpt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment