Created
November 4, 2017 18:40
-
-
Save behzod/af3bf9d20dcb099664c5acdf384ac7ea to your computer and use it in GitHub Desktop.
Sample Script for the "Introduction to WP-CLI" presentation (WPRS 2017)
This file contains 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
#!/usr/bin/env bash | |
# Create the public_html folder and switch to it | |
mkdir public_html | |
cd public_html | |
# Download the WP core | |
wp core download | |
# Configure database settings | |
wp config create --dbname=example_website_dev --dbuser=root --dbpass=root | |
# Create the database | |
wp db create | |
# Install WP core | |
wp core install --url='http://example-website.dev' --title='Example Website' --admin_user=admin --admin_password=admin --admin_email=admin@example-website.dev | |
# Change the website's description | |
wp option update blogdescription 'Just another Example Website' | |
# Set the time zone | |
wp option update timezone_string 'America/Los_Angeles' | |
# Delete Akismet and Hello plugins | |
wp plugin delete akismet | |
wp plugin delete hello | |
# Install a theme from wordpress.org theme directory | |
wp theme install sydney | |
# Create a child theme | |
wp scaffold child-theme my-theme --parent_theme=sydney | |
# Activate the child theme | |
wp theme activate my-theme | |
# Install required plugins for the theme | |
wp plugin install siteorigin-panels --activate | |
wp plugin install sydney-toolbox --activate | |
# Trash the 'Hello world!' post | |
wp post delete 1 | |
# Trash the 'Sample page' | |
wp post delete 2 | |
# Create some pages | |
wp post create --post_type=page --post_title='Contact us' --post_status='publish' | |
wp post create --post_type=page --post_title='About us' --post_status='publish' | |
# Generate some posts with fetched content from loripsum.net. | |
curl http://loripsum.net/api/5 | wp post generate --post_content --count=10 | |
# Create a menu | |
wp menu create 'Main Menu' | |
# Assign a location to the menu. | |
wp menu location assign main-menu primary | |
# Add all pages to the main menu | |
wp post list --post_type='page' --format=ids | xargs -d ' ' -I % wp menu item add-post main-menu % |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment