wp_trim_excerpt [ WordPress Function ]
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Generates an excerpt from the content, if needed.
The excerpt word amount will be 55 words and if the amount is greater than that, then the string ' [...]' will be appended to the excerpt. If the string is less than 55 words, then the content will be returned as is.
The 55 word limit can be modified by plugins/themes using the excerpt_length filter The ' [...]' string can be modified by plugins/themes using the excerpt_more filter
Source
<?php
function wp_trim_excerpt($text = '') {
$raw_excerpt = $text;
if ( '' == $text ) {
$text = get_the_content('');
$text = strip_shortcodes( $text );
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$excerpt_length = apply_filters('excerpt_length', 55);
$excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
}
return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/wp trim excerpt « WordPress Codex
Description. Generates an excerpt from the content, if needed. The excerpt word amount will be 55 words and if the amount is greater than that, then the string ' [.
codex.wordpress.org - Using wp_trim_excerpt to get the_excerpt() outside the loop
Jan 14, 2011 ... Tracking down the function, it looks like it uses wp_trim_excerpt from wp-includes /formatting.php to create excerpts on the fly. I am calling it in ...
wordpress.stackexchange.com - wp_trim_excerpt? - CSS-Tricks Forums
But that won't work in this case, so in my search i found the function wp_trim_excerpt(), and when you put some text into this function, it will give ...
css-tricks.com - Improving WordPress' the_excerpt() template tag - Aaron Russell
Nov 13, 2008 ... This function is called wp_trim_excerpt() but it is important that we call it something unique. I'm going to rename it improved_trim_excerpt() but ...
aaronrussell.co.uk