Created
September 25, 2019 04:56
-
-
Save imarkdesigns/2e5517d3640fa3b2d10c522698fee686 to your computer and use it in GitHub Desktop.
Word Count #wp #php
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 | |
| // Use AdvancedCustomFields for the content | |
| $word_count = str_word_count( strip_tags( get_field('content') ) ); | |
| if ($word_count > 39) { | |
| echo '<p><a href="'.get_permalink().'">Read More</a></p>'; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment