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
| #!/bin/bash | |
| # Check if this site has WP installed first | |
| wpCore=null; | |
| echo 'Checking for Wordpress...' | |
| if wp core is-installed; then | |
| # WP is installed. Let's do some things we should only do in a confirmed WP environment. | |
| echo 'Wordpress is installed' | |
| wpCore=true; | |
| else |
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
| // Get the post content (within the Loop) | |
| $copy = get_the_content(); | |
| // Strip all HTML from the content | |
| $cleaned = strip_tags($copy); | |
| // Get the word count | |
| $word_count = str_word_count($cleaned, 0); | |
| // Set up string to use | |
| $mins = ''; | |
| // Calculate read time in min (based on average 230 WPM) | |
| if (floor($word_count / 230) < 1) : $mins = '1'; else : $mins = floor($word_count / 230); endif; |