wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
wp_html_excerpt › WordPress Function
Desde2.5.0
Obsoleton/a
› wp_html_excerpt ( $str, $count, $more = null )
| Parâmetros: (3) |
|
| Retorna: |
|
| Definido em: |
|
| Codex: |
Safely extracts not more than the first $count characters from HTML string.
UTF-8, tags and entities safe prefix extraction. Entities inside will NOT be counted as one character. For example & will be counted as 4, < as 3, etc.Funções relacionadas: wp_trim_excerpt, wp_html_split, has_excerpt, the_excerpt, wp_embed_excerpt_more
Fonte
function wp_html_excerpt( $str, $count, $more = null ) {
if ( null === $more ) {
$more = '';
}
$str = wp_strip_all_tags( $str, true );
$excerpt = mb_substr( $str, 0, $count );
// Remove part of an entity at the end.
$excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt );
if ( $str !== $excerpt ) {
$excerpt = trim( $excerpt ) . $more;
}
return $excerpt;
}