Created
May 29, 2015 12:17
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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