Skip to content

Instantly share code, notes, and snippets.

@josephfusco
Last active January 18, 2018 16:32
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 josephfusco/25764ac62536e2366920b92ced3df9aa to your computer and use it in GitHub Desktop.
Save josephfusco/25764ac62536e2366920b92ced3df9aa to your computer and use it in GitHub Desktop.
#!/bin/bash
admin_email="hello@josephfus.co"
admin_username="admin"
admin_password="password"
db_prefix="demowp_"
sites_directory="$HOME/Demo"
# Create folder for site.
mkdir $sites_directory/$1 && cd $sites_directory/$1
# Download WordPress & setup database
wp core download
wp core config --dbname="${db_prefix}${1}" --dbuser=root --dbhost=127.0.0.1
wp db create
wp core install --url="$1".test --title="$1" --admin_user="$admin_username" --admin_password="$admin_password" --admin_email="$admin_email" --skip-email
# Remove plugins.
wp plugin delete hello
wp plugin delete akismet
# Install plugins.
wp plugin install wordpress-importer --activate
wp plugin install contact-form-7
wp plugin install advanced-custom-fields --activate
wp plugin install https://github.com/josephfusco/wp-self-destruct/archive/master.zip --activate
wp plugin install https://github.com/josephfusco/authenticate-everyone/archive/master.zip --activate
wp plugin install https://github.com/josephfusco/wp-skip-trash/archive/master.zip --activate
# Download & activate theme.
wp theme install checathlon --activate
# Import theme unit test data.
wp import ~/test-data/wptest.xml --authors=create # Downloaded from http://wptest.io/
# Remove menus from wptest.xml import
wp menu delete empty-menu
wp menu delete long-menu
wp menu delete testing-menu
# Create our own test menu.
wp menu create my-test-menu
wp menu location assign my-test-menu primary
wp menu item add-post my-test-menu 919 # Based off wptest.xml data.
wp menu item add-post my-test-menu 1086 # Based off wptest.xml data.
wp menu item add-custom my-test-menu '💣 Self Destruct' http://${1}.dev/wp-admin/tools.php?page=self-destruct
# Discourage search engines.
wp option update blog_public 0
# Set pretty permalinks.
wp rewrite structure '/%postname%/' --hard
wp rewrite flush --hard
# Open newly created site in browser.
open http://${1}.test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment