Created
April 25, 2019 09:37
-
-
Save FreshLondon/e86802e93c239d728c09bd2ce9107bce to your computer and use it in GitHub Desktop.
Create excerpt from ACF field
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
<? | |
// lets assume the ACF field we want to create an excerpt for is called 'content' | |
$raw_content = get_field('content'); | |
$trimmed_content = wp_trim_words($raw_content); | |
$clean_excerpt = apply_filters('the_excerpt', $trimmed_content); | |
echo $clean_excerpt; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment