Skip to content

Instantly share code, notes, and snippets.

@etiennejcharles
Forked from mattbanks/wp-setup.sh
Created September 2, 2017 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etiennejcharles/8c45abbc7e529c9e9048e961056cdf11 to your computer and use it in GitHub Desktop.
Save etiennejcharles/8c45abbc7e529c9e9048e961056cdf11 to your computer and use it in GitHub Desktop.
Scaffold a new WordPress development site in Alfred, utilizing WP-CLI. Use this script to run as a Terminal Script. Customize for your theme needs, plugin needs, etc.
# Create directory for new site
cd ~/Sites
mkdir {query}
cd {query}
# Download latest version of WordPress
wp core download
# Setup wp-config file with WP_DEBUG enabled
wp core config --dbname={query} --dbuser=root --dbpass=root --dbprefix={query}wp_ --extra-php <<PHP
define( 'WP_DEBUG', true );
PHP
# Create database
wp db create
# Clone WordPress Starter Theme
cd wp-content/themes
git clone git@github.com:mattbanks/WordPress-Starter-Theme.git {query} > /dev/null 2>&1
cd {query}
rm -rf .git
rm README.md
# Setup new git repo for theme
git init > /dev/null 2>&1
git add . > /dev/null 2>&1
git commit . -m "initial commit" > /dev/null 2>&1
# CD back to site directory
cd ~/Sites/{query}
# Install WordPress
wp core install --url="http://{query}.dev" --title="{query}" --admin_user=mattbanks --admin_password=password --admin_email="matt@kernelcreativemedia.com"
# Update Options
wp option update blogdescription ''
wp option update start_of_week 0
wp option update timezone_string 'America/New_York'
wp option update permalink_structure '/%postname%'
# Get rid of default themes and Hello Dolly plugin
wp theme delete twentytwelve
wp theme delete twentythirteen
wp theme delete twentyfourteen
wp plugin delete hello
# Get plugins
wp plugin install wordpress-seo --activate
wp plugin install use-google-libraries --activate
wp plugin install pods --activate
wp plugin install google-analytics-for-wordpress --activate
# Activate theme
wp theme activate {query}
# Open ST3, Finder and Chrome
stt
oo
open http://{query}.dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment