Skip to content

Instantly share code, notes, and snippets.



Last active May 16, 2020
What would you like to do?
Shell Scipt for local WordPress creation using Valet
# Ref wp-cli-valet -
# Set up Terminal styles
# 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="" --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="" --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 "$1"
cd $1
rm -rf .git/
git clone 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/ .
cp ../themes/lib/plugins/ .
cp ../themes/lib/plugins/ .
cp ../themes/lib/plugins/ .
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