| 1804 | | $text = strip_shortcodes( $text ); |
| | 1807 | /** |
| | 1808 | * Limit the length of a text |
| | 1809 | * |
| | 1810 | * The trimed text amount will be 55 words and if the amount is greater than |
| | 1811 | * that, then the string ' [...]' will be appended to the trimed text. If the text |
| | 1812 | * is less than 55 words, then the text filtered will be returned as is. |
| | 1813 | * |
| | 1814 | * @since 3.0.0 |
| | 1815 | * |
| | 1816 | * @param string $text The text to trim. |
| | 1817 | * @param string $excerpt_length The lenght of words. |
| | 1818 | * @param string $excerpt_more The suffix append to the text. |
| | 1819 | * @param string $filtered_content Flag for active/deactive wordpress filtering content. |
| | 1820 | * @return string The text trimed. |
| | 1821 | */ |
| | 1822 | function wp_trim_text( $text = '', $excerpt_length = 55, $excerpt_more = '[...]', $filtered_content = false ) { |
| | 1823 | $raw_excerpt = $text; |
| | 1824 | if ( !empty($text) ) { |
| | 1825 | if ( $filtered_content == false ) { |
| | 1826 | $text = strip_shortcodes( $text ); |
| 1806 | | $text = apply_filters('the_content', $text); |
| 1807 | | $text = str_replace(']]>', ']]>', $text); |
| 1808 | | $text = strip_tags($text); |
| 1809 | | $excerpt_length = apply_filters('excerpt_length', 55); |
| 1810 | | $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]'); |
| | 1828 | $text = apply_filters('the_content', $text); |
| | 1829 | $text = str_replace(']]>', ']]>', $text); |
| | 1830 | $text = strip_tags($text); |
| | 1831 | } |
| | 1832 | |