Last active
May 16, 2020 02:08
-
-
Save neilgee/e51b184ebf4cd61080f1996a08c34b9f to your computer and use it in GitHub Desktop.
Shell Scipt for local WordPress creation using Valet
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 | |
# Ref wp-cli-valet - https://github.com/aaemnnosttv/wp-cli-valet-command | |
# Set up Terminal styles | |
VP_NONE='\033[00m' | |
VP_RED='\033[01;31m' | |
VP_GREEN='\033[01;32m' | |
VP_YELLOW='\033[01;33m' | |
VP_PURPLE='\033[01;35m' | |
VP_CYAN='\033[01;36m' | |
VP_WHITE='\033[01;37m' | |
VP_BOLD='\033[1m' | |
VP_UNDERLINE='\033[4m' | |
# Change current directory to Sites | |
cd ~/Sites/ | |
# Create WordPress site | |
#wp valet new $1 --dbname="wp_$1" --dbuser="root" --dbpass="" --dbprefix="wp_" --admin_user="wsladmin" --admin_password='a$4u&meWSL#1' --admin_email="[email protected]" --unsecure | |
wp valet new $1 --version="5.4.1" --locale="en_AU" --dbname="wp_$1" --dbuser="root" --dbpass="" --dbprefix="wp_" --admin_user="wsladmin" --admin_password='a$4u&meWSL#1' --admin_email="[email protected]" --unsecure | |
# Site creation success message | |
echo -e "${VP_GREEN}Success:${VP_NONE} $1 created" | |
# Make https - I have hashed this as I want it non-https | |
# valet secure $1 | |
# Navigate to themes directory | |
cd ~/Sites/ | |
cd $1/wp-content/themes | |
# copy all the content from my folder | |
cp -a ~/Sites/zips/*.zip . | |
unzip '*.zip' | |
rm -rf __MACOSX/ | |
rm *.zip | |
# Clone my GitHub Theme & Gulp Task runner | |
git clone https://github.com/neilgee/beavertron.git "$1" | |
cd $1 | |
rm -rf .git/ | |
git clone https://github.com/neilgee/geegulp.git geegulp | |
mv geegulp/gulpfile.js . | |
mv geegulp/package.json . | |
rm -rf geegulp/ | |
# Swap site name in | |
sed -i '' "s/mysite/$1/g" ./gulpfile.js | |
npm i | |
# Activate my theme | |
wp theme activate $1 | |
#wp theme activate bb-theme | |
# Delete 2015, 2016, 2017 WordPress Default Themes | |
wp theme delete twentyfifteen twentysixteen twentyseventeen twentynineteen twentytwenty | |
mkdir image-fat image-slim | |
# Navigate to plugins directory | |
cd ~/Sites/ | |
cd $1/wp-content/plugins | |
# Copy all the content from my Dropbox/plugins | |
cp ../themes/lib/plugins/bb-plugin-pro.zip . | |
cp ../themes/lib/plugins/bb-theme-builder.zip . | |
cp ../themes/lib/plugins/bb-ultimate-addon.zip . | |
cp ../themes/lib/plugins/wp-sync-db-master.zip . | |
unzip '*.zip' | |
rm -rf __MACOSX/ | |
rm *.zip | |
# Delete Hello Dolly - (but keeping Akismet) | |
wp plugin delete hello | |
#wp plugin delete akismet | |
# Update all plugins | |
wp plugin update --all | |
# Install some WP Repo plugins | |
wp plugin install wordpress-importer | |
wp plugin install duplicate-post | |
wp plugin install classic-editor | |
# Activate all plugins | |
wp plugin activate --all | |
# Register my Beaver | |
wp beaver register --license=7a62702e706e7a40616e656a627461 | |
wp brainstormforce license activate uabb 9a3670d48390b156872f4b19b7b4302f | |
wp plugin deactivate 'bb-ultimate-addon' | |
#wp option get permalink_structure | |
wp option update permalink_structure '/%postname%/' | |
# Set the timezone | |
wp option update timezone_string "Australia/Sydney" | |
# Launch the site in default browser 👊 | |
valet open $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment