Skip to content

Instantly share code, notes, and snippets.

@brichards
Created February 7, 2022 16:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brichards/513ea72e9dcb29d06fc688fae876a8b0 to your computer and use it in GitHub Desktop.
Save brichards/513ea72e9dcb29d06fc688fae876a8b0 to your computer and use it in GitHub Desktop.
A shell function to create a directory, install WordPress, configure SSL via Laravel Valet, an launch the site in Chrome
# Install a new WP site.
# Usage: wpinstall <sitename>
function wpinstall() {
# Make the directory in your local web root
mkdir ~/Sites/www/$@;
cd ~/Sites/www/$@;
# Download, config, and install WordPress using <sitename> for the database, URL, and site title
# Note: You'll need to configure your wp-cli defaults for core config and core install in a wp-cli.yml file
wp core download;
wp core config --dbname=$@;
wp db create;
wp core install --url=https://$@.test --title=$( tr '[A-Z]' '[a-z]' <<< $@ );
# Configure SSL for the site with Laravel Valet
valet secure $@;
# Open the site in Chrome,
open -a "Google Chrome" https://$@.test/wp-admin;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment