Skip to content

Instantly share code, notes, and snippets.

View chuneycu2's full-sized avatar
🎯
Focusing

Cyrus Huneycutt chuneycu2

🎯
Focusing
View GitHub Profile
@chuneycu2
chuneycu2 / update-plugins.sh
Last active November 25, 2025 02:20
WordPress plugin update script
#!/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
@chuneycu2
chuneycu2 / readtime.php
Last active December 18, 2025 19:23
Configurable snippet to calculate the average reading time for a blog post or any field containing a large amount of text
// 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;