-
-
Save Alexander-Pop/62e08b234236269bc83a5841f2977792 to your computer and use it in GitHub Desktop.
Limit WordPress' the_excerpt to the first full stop / period #wp
This file contains 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
<?php | |
// Limit WordPress' the_excerpt to the first full stop / period | |
$strings = preg_split('/(\.|!|\?)\s/', strip_tags($post->post_content), 2, PREG_SPLIT_DELIM_CAPTURE); | |
$excerpt = apply_filters('the_excerpt', $strings[0] . $strings[1]); | |
echo $excerpt; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment