Last active
July 24, 2024 18:15
-
-
Save barbwiredmedia/9104505 to your computer and use it in GitHub Desktop.
Wordpress trim words shorten post meta / custom field. ACF wp_trim_words create an excerpt. http://codex.wordpress.org/Function_Reference/wp_trim_words
This file contains hidden or 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 | |
$content = get_post_meta($post->ID, your_custom_field_meta, true); | |
$trimmed_content = wp_trim_words($content, 15, '... <a href="' . get_permalink() . '">Read More</a>'); | |
echo $trimmed_content; | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're quite welcome!