| 1845 | * Creates an excerpt from the given text. |
| 1846 | * |
| 1847 | * @since 3.2 |
| 1848 | * |
| 1849 | * @param string $text The text from which to make an excerpt. |
| 1850 | * @param int $excerpt_length The max number of words for the excerpt. |
| 1851 | * @param string $excerpt_more The text to use for the more ellipses. |
| 1852 | * @return string The excerpt. |
| 1853 | */ |
| 1854 | function wp_make_excerpt( $text, $excerpt_length = 55, $excerpt_more = ' [...]' ) { |
| 1855 | $text = strip_shortcodes( $text ); |
| 1856 | $text = apply_filters('the_content', $text); |
| 1857 | $text = str_replace(']]>', ']]>', $text); |
| 1858 | $text = strip_tags($text); |
| 1859 | $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY); |
| 1860 | if ( count($words) > $excerpt_length ) { |
| 1861 | array_pop($words); |
| 1862 | $text = implode(' ', $words); |
| 1863 | $text = $text . $excerpt_more; |
| 1864 | } else { |
| 1865 | $text = implode(' ', $words); |
| 1866 | } |
| 1867 | |
| 1868 | return $text; |
| 1869 | } |
| 1870 | |
| 1871 | /** |
1871 | | $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY); |
1872 | | if ( count($words) > $excerpt_length ) { |
1873 | | array_pop($words); |
1874 | | $text = implode(' ', $words); |
1875 | | $text = $text . $excerpt_more; |
1876 | | } else { |
1877 | | $text = implode(' ', $words); |
1878 | | } |
| 1893 | $text = wp_make_excerpt( $text, $excerpt_length, $excerpt_more ); |