Skip to content

Instantly share code, notes, and snippets.

@danielpost
Last active March 25, 2021 20:12
Show Gist options
  • Save danielpost/4f0545e1d7a71130d8c90e5844c2312d to your computer and use it in GitHub Desktop.
Save danielpost/4f0545e1d7a71130d8c90e5844c2312d to your computer and use it in GitHub Desktop.
Setting up a new local WordPress install
# Replace all instances of 'theme-name' with the name of your project.
# Create a new repo for the theme
# Uses https://github.com/aaemnnosttv/wp-cli-valet-command/
cd ~/Dev/posty/
gh repo create posty-studio/theme-name --template="posty-studio/posty-starter-theme"
cd theme-name
git pull origin master
git checkout -b dev
# Install dependencies
composer install
npm install
npm run build
# Create a new WordPress installation
cd ~/Dev/valet/
wp valet new theme-name
cd theme-name
wp option update blogname 'Theme Name'
wp option update blogdescription ''
wp rewrite structure '/%postname%/'
# Make symlink to theme and activate
ln -s ~/Dev/posty/theme-name ~/Dev/valet/theme-name/wp-content/themes/theme-name
# Remove default plugins
wp plugin uninstall $(wp plugin list --field=name) --deactivate
# Activate our theme and delete others
wp theme activate theme-name
wp theme delete $(wp theme list --status=inactive --field=name)
# Setup local debugging
wp plugin install fakerpress --activate
wp plugin install spatie-ray --activate
wp plugin install query-monitor --activate
wp config set WP_DEBUG true --raw
wp config set WP_ENVIRONMENT_TYPE local
wp config set DISABLE_WP_CRON true --raw
wp config set DB_HOST "isset( \$_SERVER['SCRIPT_NAME'] ) && false !== stripos( \$_SERVER['SCRIPT_NAME'], 'tinkerwell' ) ? '127.0.0.1:3306' : 'localhost'" --raw
# Open admin
wp admin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment