SlideShare ist ein Scribd-Unternehmen logo
1 von 61
Downloaden Sie, um offline zu lesen
1. Intro
2. WP-CLI Basics
3. Install WordPress
4. Plugin and Theme Automation
5. PHP7 Compatibility Checker
6. Advanced
Agenda
_____ _ _ _ _
|_ _| | | | | | | (_)
| | _ __ | |_ _ __ ___ __| |_ _ ___| |_ _ ___ _ __
| | | '_ | __| '__/ _  / _` | | | |/ __| __| |/ _ | '_ 
_| |_| | | | |_| | | (_) | (_| | |_| | (__| |_| | (_) | | | |
|_____|_| |_|__|_| ___/ __,_|__,_|___|__|_|___/|_| |_|
•Sales Engineer - WP Engine
•Developer, Freelancer
•CMS Specialist
•Open Source
•Speaker
Edmund Turbin
WordCamp Stockholm - Nov 2016
THERE ARE TWO TYPES OF PEOPLE IN THE WORLD
I ❤
WHY USE COMMANDS?
•Quickly execute a task
•Bundle many tasks together in scripts
•Avoid using the keyboard and mouse
•Simplify repetitive tasks
•and also…
WHY USE COMMANDS?SO WE CAN BE LAZY
____ _
| _  (_)
| |_) | __ _ ___ _ ___ ___
| _ < / _` | / __| | | / __| / __|
| |_) | | (_| | __  | | | (__ __ 
|____/ __,_| |___/ |_| ___| |___/
WHAT DO I NEED TO GET STARTED?
•Local Dev Environment with PHP - VVV, MAMP, WAMP
•Terminal - Terminal App, iTerm 2, PuTTY
•Text Editor - Sublime, Atom
PREREQUISITES
INSTALL WP-CLI
curl -O https://raw.githubusercontent.com/wp-cli/
builds/gh-pages/phar/wp-cli.phar
https://make.wordpress.org/cli/handbook/installing/
INSTALL WP-CLI
# Make file executable
chmod +x wp-cli.phar
# Move file to proper location
sudo mv wp-cli.phar /usr/local/bin/wp
https://make.wordpress.org/cli/handbook/installing/
INSTALL WP-CLI
• change into a WP directory
• run $wp cli info
https://make.wordpress.org/cli/handbook/installing/
TEST THE INSTALLATION
COMMAND STRUCTURE
$wp command subcommand value
$wp theme install twentysixteen
_____ __ _ _ _
/ ____| / _(_) | | (_)
| | ___ _ __ | |_ _ __ _ _ _ _ __ __ _| |_ _ ___ _ __
| | / _ | '_ | _| |/ _` | | | | '__/ _` | __| |/ _ | '_ 
| |___| (_) | | | | | | | (_| | |_| | | | (_| | |_| | (_) | | | |
________/|_| |_|_| |_|__, |__,_|_| __,_|__|_|___/|_| |_|
__/ |
|___/
WHAT HAVE I DONE?
• Installed WP-CLI locally
• Configured a WP-CLI alias to SSH into remotes
• I can execute remote commands as if they were on my local
machine
• No need for local MySQL/PHP/Apache
• Alternate - use SSH directly into VVV using vagrant ssh
CONFIGURATION
•Alias called @dev allows me to run remote commands
• $wp @dev cli info is different than $wp cli info
• @dev connects via SSH and runs on Vagrant box
https://make.wordpress.org/cli/handbook/config/
wp-cli.yml - Aliases with Vagrant
CONFIGURATION
•Allows you to configure WP-CLI variables
•File can be at the Global, Project and Local levels
•e.g.: Local overrides Global
•Allows you to set up Aliases per site
https://make.wordpress.org/cli/handbook/config/
wp-cli.yml
CONFIGURATION
@dev:
ssh: vagrant@wpcli-test.dev/srv/www/wpcli-test
https://make.wordpress.org/cli/handbook/installing/
wp-cli.yml - Aliases with Vagrant
_____ _
/ ____| | |
| | ___ _ __ ___ _ __ ___ __ _ _ __ __| | ___
| | / _  | '_ ` _  | '_ ` _  / _` | | '_  / _` | / __|
| |____ | (_) | | | | | | | | | | | | | | (_| | | | | | | (_| | __ 
_____| ___/ |_| |_| |_| |_| |_| |_| __,_| |_| |_| __,_| |___/
CORE OPERATIONS
•Downloads the recent version of WordPress to the current directory
$wp core download
CORE OPERATIONS
•Creates WordPress configuration file.
•This file tells WP-CLI how connect to you’re site’s database
$wp core config
DATABASE OPERATIONS
•Create a database for your WordPress install
•Depends on a wp-config.php file to work
$wp db create
CORE OPERATIONS
•Completes the WordPress install process
$wp core install
INSTALL WORDPRESS
# Download WordPress
$wp core download
# Create WordPress configuration - wp-config.php
$wp core config
—-dbuser=root --dbpass=root —-dbname=wpcli-test
INSTALL WORDPRESS
# Create Database for install
$wp db create wpcli-test
# Run the install process
$wp core install
—url=wpcli-test.dev —-title=“wpcli test”
—admin_user=admin --admin_password=password
--admin_email=info@example.com
INSTALL WORDPRESS
•Not needed if you’re using VVV
•WP installs can be created and provisioned via Vagrant
Note for VVV Users
https://varyingvagrantvagrants.org/
GETTING HELP
$wp help
INSTALL A PLUGIN
$wp plugin install wp-site-migrate —-activate
_ _ _
/ | | | | (_)
/  _ _ | |_ ___ _ __ ___ __ _ | |_ _ ___ _ __
/ /  | | | | | __| / _  | '_ ` _  / _` | | __| | | / _  | '_ 
/ ____  | |_| | | |_ | (_) | | | | | | | | (_| | | |_ | | | (_) | | | | |
/_/ _ __,_| __| ___/ |_| |_| |_| __,_| __| |_| ___/ |_| |_|
SHELL SCRIPTING
•You can use WP CLI with like any other command
•e.g. tie commands together and run them as a list
INSTALL WORDPRESS PLUGINS, THEME
#!/bin/bash
# list of plugins
plugins=("user-switching" "debug-objects""wp-cfm")
# loop through plugin list and install
for plugin in ${plugins[*]};
do
wp plugin install $plugin
wp plugin activate $plugin
done
CREATE CHILD THEME
wp scaffold child-theme generated-child-theme --
parent_theme=twentyseventeen --theme_name='Generated
Child Theme' --activate
INSTALL UNDERSCORE_S THEME
#!/bin/bash
# Installl _s theme with Unit Tests
echo "Enter site name:"
read theme_name
wp scaffold _s $theme_name
wp theme activate $theme_name
wp scaffold theme-tests $theme_name
GENERATE CONTENT
wp any-ipsum generate-posts
wp post generate --count=10 --post_type=page
wp comment generate --count=10
_____ _ _ _____ ______ _____ _ _
| __  | | | | | __  |____ | / ____| | | | |
| |__) | | |__| | | |__) | / / | | | |__ ___ ___ | | __
| ___/ | __ | | ___/ / / | | | '_  / _  / __| | |/ /
| | | | | | | | / / | |____ | | | | | __/ | (__ | <
|_| |_| |_| |_| /_/ _____| |_| |_| ___| ___| |_|_
PHP COMPATIBILITY COMMAND
•Run PHP7 Compatibility Checker
•Plugin needs to be installed
•Version supplied as an argument
wp phpcompat 7.0
RUN PHP COMPATIBILITY CHECK SCRIPT
#!/bin/bash
wp plugin install php-compatibility-checker
wp plugin activate php-compatibility-checker
wp phpcompat 7.0 > php-compat-results.txt
PLUGINS WITH COMMANDS
•ACF
•Elastic press
•Migrate, migrated
•caching plugins
•PHP Compatibility
•Regen thumbs
•widget import/export
•developer
•wp-cfm
•backupwordpress
https://make.wordpress.org/cli/handbook/tools/
_ _
/ | | | |
/  __| | __ __ __ _ _ __ ___ ___ __| |
/ /  / _` |   / / / _` | | '_  / __| / _  / _` |
/ ____  | (_| |  V / | (_| | | | | | | (__ | __/ | (_| |
/_/ _ __,_| _/ __,_| |_| |_| ___| ___| __,_|
SHELL ALIAS COMMAND
Create a shortcut command for things that are
frequently used to cut down on keystrokes.
alias - show all aliases
SHELL ALIASES
Create an alias
alias pu=“wp plugin update --all”
SHELL ALIASES
Remove an alias
unalias pu
SHELL ALIASES
Arguments
alias pi='wp plugin install’
pi wp-smushit
SHELL ALIASES
Aliases can be saved and managed from .bash_profile
CUSTOM SHELL COMMANDS
• functions can be created in your shell profile (.bash_profile) and
executed globaly
gen-content ()
{
wp any-ipsum generate-posts
wp comment generate --count=10
}
WP-CLI is a toolbox
Commands can be linked
together via scripts to
automate complex tasks
WP-CLI for Themeing
WP-CLI can be one of many tools
to get your development process
started quickly
Good, Better, Best
•Single Commands & Aliases
•Shell Scripts
•Custom Shell Commands
Helpful Links
Command Cookbook
https://make.wordpress.org/cli/handbook/commands-cookbook/
Shell Friends
https://make.wordpress.org/cli/handbook/shell-friends/
Plugins that work with WP-CLI
https://make.wordpress.org/cli/handbook/tools/
WP-CLI Configuration
https://make.wordpress.org/cli/handbook/config/
Shell Scripting
https://www.shellscript.sh/
Advanced WordPress Management with WP-CLI
https://www.smashingmagazine.com/2015/09/wordpress-management-with-wp-cli/
Thank you!
@spicecadet
edmund.turbin@wpengine.com

Weitere ähnliche Inhalte

Was ist angesagt?

Creating Local WordPress Installs
Creating Local WordPress InstallsCreating Local WordPress Installs
Creating Local WordPress Installsmcgaritydotme
 
Speak The Web: The HTML5 Experiments
Speak The Web: The HTML5 ExperimentsSpeak The Web: The HTML5 Experiments
Speak The Web: The HTML5 Experimentsguestd427df
 
Building a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToBuilding a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToRaymond Camden
 
Tutorial on joomla transfer moffatmn
Tutorial on joomla transfer moffatmnTutorial on joomla transfer moffatmn
Tutorial on joomla transfer moffatmnMoffat Ngacha
 
MAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATION
MAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATIONMAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATION
MAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATIONMakarand Mane
 
WP-CLI Presentation from WordCamp NYC 2015
WP-CLI Presentation from WordCamp NYC 2015WP-CLI Presentation from WordCamp NYC 2015
WP-CLI Presentation from WordCamp NYC 2015Shawn Hooper
 
Heroku addons development - Nov 2011
Heroku addons development - Nov 2011Heroku addons development - Nov 2011
Heroku addons development - Nov 2011Leonardo Borges
 
Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015Alan Lok
 
Piecing Together the WordPress Puzzle
Piecing Together the WordPress PuzzlePiecing Together the WordPress Puzzle
Piecing Together the WordPress PuzzleBusiness Vitality LLC
 
IV - CSS architecture
IV - CSS architectureIV - CSS architecture
IV - CSS architectureWebF
 
Getting Started with WP-CLI
Getting Started with WP-CLIGetting Started with WP-CLI
Getting Started with WP-CLIChristian Nolen
 
Streamlining Your Applications with Web Frameworks
Streamlining Your Applications with Web FrameworksStreamlining Your Applications with Web Frameworks
Streamlining Your Applications with Web Frameworksguestf7bc30
 
Manage WordPress From the Command Line with WP-CLI
Manage WordPress From the Command Line with WP-CLIManage WordPress From the Command Line with WP-CLI
Manage WordPress From the Command Line with WP-CLIShawn Hooper
 
Search 500-video-clips
Search 500-video-clipsSearch 500-video-clips
Search 500-video-clipsphanhung20
 
Save Time By Manging WordPress from the Command Line
Save Time By Manging WordPress from the Command LineSave Time By Manging WordPress from the Command Line
Save Time By Manging WordPress from the Command LineShawn Hooper
 
Building WordPress Client Side Applications with WP and WP-API - #wcmia
Building WordPress Client Side Applications with WP and WP-API - #wcmiaBuilding WordPress Client Side Applications with WP and WP-API - #wcmia
Building WordPress Client Side Applications with WP and WP-API - #wcmiaRoy Sivan
 
Flow Presentation vFINAL
Flow Presentation vFINALFlow Presentation vFINAL
Flow Presentation vFINALNick Spencer
 
How to build Client Side Applications with WordPress and WP-API | #wcmia
How to build Client Side Applications with WordPress and WP-API | #wcmiaHow to build Client Side Applications with WordPress and WP-API | #wcmia
How to build Client Side Applications with WordPress and WP-API | #wcmiaRoy Sivan
 

Was ist angesagt? (20)

Creating Local WordPress Installs
Creating Local WordPress InstallsCreating Local WordPress Installs
Creating Local WordPress Installs
 
Speak The Web: The HTML5 Experiments
Speak The Web: The HTML5 ExperimentsSpeak The Web: The HTML5 Experiments
Speak The Web: The HTML5 Experiments
 
Building a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToBuilding a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared To
 
Oracle APEX & PhoneGap
Oracle APEX & PhoneGapOracle APEX & PhoneGap
Oracle APEX & PhoneGap
 
Tutorial on joomla transfer moffatmn
Tutorial on joomla transfer moffatmnTutorial on joomla transfer moffatmn
Tutorial on joomla transfer moffatmn
 
MAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATION
MAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATIONMAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATION
MAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATION
 
WP-CLI Presentation from WordCamp NYC 2015
WP-CLI Presentation from WordCamp NYC 2015WP-CLI Presentation from WordCamp NYC 2015
WP-CLI Presentation from WordCamp NYC 2015
 
Heroku addons development - Nov 2011
Heroku addons development - Nov 2011Heroku addons development - Nov 2011
Heroku addons development - Nov 2011
 
Object width
Object widthObject width
Object width
 
Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015
 
Piecing Together the WordPress Puzzle
Piecing Together the WordPress PuzzlePiecing Together the WordPress Puzzle
Piecing Together the WordPress Puzzle
 
IV - CSS architecture
IV - CSS architectureIV - CSS architecture
IV - CSS architecture
 
Getting Started with WP-CLI
Getting Started with WP-CLIGetting Started with WP-CLI
Getting Started with WP-CLI
 
Streamlining Your Applications with Web Frameworks
Streamlining Your Applications with Web FrameworksStreamlining Your Applications with Web Frameworks
Streamlining Your Applications with Web Frameworks
 
Manage WordPress From the Command Line with WP-CLI
Manage WordPress From the Command Line with WP-CLIManage WordPress From the Command Line with WP-CLI
Manage WordPress From the Command Line with WP-CLI
 
Search 500-video-clips
Search 500-video-clipsSearch 500-video-clips
Search 500-video-clips
 
Save Time By Manging WordPress from the Command Line
Save Time By Manging WordPress from the Command LineSave Time By Manging WordPress from the Command Line
Save Time By Manging WordPress from the Command Line
 
Building WordPress Client Side Applications with WP and WP-API - #wcmia
Building WordPress Client Side Applications with WP and WP-API - #wcmiaBuilding WordPress Client Side Applications with WP and WP-API - #wcmia
Building WordPress Client Side Applications with WP and WP-API - #wcmia
 
Flow Presentation vFINAL
Flow Presentation vFINALFlow Presentation vFINAL
Flow Presentation vFINAL
 
How to build Client Side Applications with WordPress and WP-API | #wcmia
How to build Client Side Applications with WordPress and WP-API | #wcmiaHow to build Client Side Applications with WordPress and WP-API | #wcmia
How to build Client Side Applications with WordPress and WP-API | #wcmia
 

Ähnlich wie The Themer's Guide to WP-CLI

The Themer's Guide to WP-CLI
The Themer's Guide to WP-CLIThe Themer's Guide to WP-CLI
The Themer's Guide to WP-CLIEdmund Turbin
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp HamiltonPaul Bearne
 
Mastering WordPress Vol.1
Mastering WordPress Vol.1Mastering WordPress Vol.1
Mastering WordPress Vol.1Wataru OKAMOTO
 
Introduction to Fuel
Introduction to FuelIntroduction to Fuel
Introduction to FuelPhil Sturgeon
 
WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!Taylor Lovett
 
WordPress and The Command Line
WordPress and The Command LineWordPress and The Command Line
WordPress and The Command LineKelly Dwan
 
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...Andrea Cardinali
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIWP Engine
 
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliWordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliGetSource
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Mike Schinkel
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)arcware
 
Extending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLIExtending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLIryanduff
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress PluginBrad Williams
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingOtto Kekäläinen
 
Manage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliManage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliGetSource
 
Advanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.comAdvanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.comInstaWP Inc
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressJeroen van Dijk
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentBrad Williams
 

Ähnlich wie The Themer's Guide to WP-CLI (20)

The Themer's Guide to WP-CLI
The Themer's Guide to WP-CLIThe Themer's Guide to WP-CLI
The Themer's Guide to WP-CLI
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
 
Mastering WordPress Vol.1
Mastering WordPress Vol.1Mastering WordPress Vol.1
Mastering WordPress Vol.1
 
Introduction to Fuel
Introduction to FuelIntroduction to Fuel
Introduction to Fuel
 
WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!
 
WordPress and The Command Line
WordPress and The Command LineWordPress and The Command Line
WordPress and The Command Line
 
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
 
WPDay Bologna 2013
WPDay Bologna 2013WPDay Bologna 2013
WPDay Bologna 2013
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLI
 
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliWordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
 
Extending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLIExtending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLI
 
HTML5 Web forms & microdata - Akiva Levi
HTML5 Web forms & microdata - Akiva LeviHTML5 Web forms & microdata - Akiva Levi
HTML5 Web forms & microdata - Akiva Levi
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP Profiling
 
Manage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliManage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cli
 
Advanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.comAdvanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.com
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/Press
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
 

Mehr von Edmund Turbin

Remote Control WordPress
Remote Control WordPressRemote Control WordPress
Remote Control WordPressEdmund Turbin
 
Production Ready WordPress #WPLDN
Production Ready WordPress #WPLDNProduction Ready WordPress #WPLDN
Production Ready WordPress #WPLDNEdmund Turbin
 
Production Ready WordPress - WC Utrecht 2017
Production Ready WordPress  - WC Utrecht 2017Production Ready WordPress  - WC Utrecht 2017
Production Ready WordPress - WC Utrecht 2017Edmund Turbin
 
Production ready word press
Production ready word pressProduction ready word press
Production ready word pressEdmund Turbin
 
Configuration Management in WordPress
Configuration Management in WordPressConfiguration Management in WordPress
Configuration Management in WordPressEdmund Turbin
 
Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Edmund Turbin
 
Word press gets responsive 4x3
Word press gets responsive 4x3Word press gets responsive 4x3
Word press gets responsive 4x3Edmund Turbin
 
Scaling WooCommerce on WP Engine
Scaling WooCommerce on WP EngineScaling WooCommerce on WP Engine
Scaling WooCommerce on WP EngineEdmund Turbin
 
Working in Harmony: Manchester - Optimize development and content workflows
Working in Harmony: Manchester - Optimize development and content workflowsWorking in Harmony: Manchester - Optimize development and content workflows
Working in Harmony: Manchester - Optimize development and content workflowsEdmund Turbin
 
Woo commerce scalability notes
Woo commerce scalability   notesWoo commerce scalability   notes
Woo commerce scalability notesEdmund Turbin
 
Just For You - How to drive better engagement with localisation-based insights.
Just For You - How to drive better engagement with localisation-based insights.Just For You - How to drive better engagement with localisation-based insights.
Just For You - How to drive better engagement with localisation-based insights.Edmund Turbin
 

Mehr von Edmund Turbin (13)

Remote Control WordPress
Remote Control WordPressRemote Control WordPress
Remote Control WordPress
 
Production Ready WordPress #WPLDN
Production Ready WordPress #WPLDNProduction Ready WordPress #WPLDN
Production Ready WordPress #WPLDN
 
Production Ready WordPress - WC Utrecht 2017
Production Ready WordPress  - WC Utrecht 2017Production Ready WordPress  - WC Utrecht 2017
Production Ready WordPress - WC Utrecht 2017
 
Production ready word press
Production ready word pressProduction ready word press
Production ready word press
 
Configuration Management in WordPress
Configuration Management in WordPressConfiguration Management in WordPress
Configuration Management in WordPress
 
Customize it.
Customize it.Customize it.
Customize it.
 
Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?
 
Word press gets responsive 4x3
Word press gets responsive 4x3Word press gets responsive 4x3
Word press gets responsive 4x3
 
Scaling WooCommerce on WP Engine
Scaling WooCommerce on WP EngineScaling WooCommerce on WP Engine
Scaling WooCommerce on WP Engine
 
Working in Harmony: Manchester - Optimize development and content workflows
Working in Harmony: Manchester - Optimize development and content workflowsWorking in Harmony: Manchester - Optimize development and content workflows
Working in Harmony: Manchester - Optimize development and content workflows
 
Working in harmony
Working in harmonyWorking in harmony
Working in harmony
 
Woo commerce scalability notes
Woo commerce scalability   notesWoo commerce scalability   notes
Woo commerce scalability notes
 
Just For You - How to drive better engagement with localisation-based insights.
Just For You - How to drive better engagement with localisation-based insights.Just For You - How to drive better engagement with localisation-based insights.
Just For You - How to drive better engagement with localisation-based insights.
 

Kürzlich hochgeladen

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Kürzlich hochgeladen (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

The Themer's Guide to WP-CLI

  • 1.
  • 2. 1. Intro 2. WP-CLI Basics 3. Install WordPress 4. Plugin and Theme Automation 5. PHP7 Compatibility Checker 6. Advanced Agenda
  • 3. _____ _ _ _ _ |_ _| | | | | | | (_) | | _ __ | |_ _ __ ___ __| |_ _ ___| |_ _ ___ _ __ | | | '_ | __| '__/ _ / _` | | | |/ __| __| |/ _ | '_ _| |_| | | | |_| | | (_) | (_| | |_| | (__| |_| | (_) | | | | |_____|_| |_|__|_| ___/ __,_|__,_|___|__|_|___/|_| |_|
  • 4. •Sales Engineer - WP Engine •Developer, Freelancer •CMS Specialist •Open Source •Speaker Edmund Turbin WordCamp Stockholm - Nov 2016
  • 5. THERE ARE TWO TYPES OF PEOPLE IN THE WORLD
  • 6.
  • 8.
  • 9. WHY USE COMMANDS? •Quickly execute a task •Bundle many tasks together in scripts •Avoid using the keyboard and mouse •Simplify repetitive tasks •and also…
  • 10. WHY USE COMMANDS?SO WE CAN BE LAZY
  • 11. ____ _ | _ (_) | |_) | __ _ ___ _ ___ ___ | _ < / _` | / __| | | / __| / __| | |_) | | (_| | __ | | | (__ __ |____/ __,_| |___/ |_| ___| |___/
  • 12. WHAT DO I NEED TO GET STARTED? •Local Dev Environment with PHP - VVV, MAMP, WAMP •Terminal - Terminal App, iTerm 2, PuTTY •Text Editor - Sublime, Atom PREREQUISITES
  • 13. INSTALL WP-CLI curl -O https://raw.githubusercontent.com/wp-cli/ builds/gh-pages/phar/wp-cli.phar https://make.wordpress.org/cli/handbook/installing/
  • 14. INSTALL WP-CLI # Make file executable chmod +x wp-cli.phar # Move file to proper location sudo mv wp-cli.phar /usr/local/bin/wp https://make.wordpress.org/cli/handbook/installing/
  • 15. INSTALL WP-CLI • change into a WP directory • run $wp cli info https://make.wordpress.org/cli/handbook/installing/ TEST THE INSTALLATION
  • 16. COMMAND STRUCTURE $wp command subcommand value $wp theme install twentysixteen
  • 17. _____ __ _ _ _ / ____| / _(_) | | (_) | | ___ _ __ | |_ _ __ _ _ _ _ __ __ _| |_ _ ___ _ __ | | / _ | '_ | _| |/ _` | | | | '__/ _` | __| |/ _ | '_ | |___| (_) | | | | | | | (_| | |_| | | | (_| | |_| | (_) | | | | ________/|_| |_|_| |_|__, |__,_|_| __,_|__|_|___/|_| |_| __/ | |___/
  • 18. WHAT HAVE I DONE? • Installed WP-CLI locally • Configured a WP-CLI alias to SSH into remotes • I can execute remote commands as if they were on my local machine • No need for local MySQL/PHP/Apache • Alternate - use SSH directly into VVV using vagrant ssh
  • 19. CONFIGURATION •Alias called @dev allows me to run remote commands • $wp @dev cli info is different than $wp cli info • @dev connects via SSH and runs on Vagrant box https://make.wordpress.org/cli/handbook/config/ wp-cli.yml - Aliases with Vagrant
  • 20.
  • 21. CONFIGURATION •Allows you to configure WP-CLI variables •File can be at the Global, Project and Local levels •e.g.: Local overrides Global •Allows you to set up Aliases per site https://make.wordpress.org/cli/handbook/config/ wp-cli.yml
  • 23. _____ _ / ____| | | | | ___ _ __ ___ _ __ ___ __ _ _ __ __| | ___ | | / _ | '_ ` _ | '_ ` _ / _` | | '_ / _` | / __| | |____ | (_) | | | | | | | | | | | | | | (_| | | | | | | (_| | __ _____| ___/ |_| |_| |_| |_| |_| |_| __,_| |_| |_| __,_| |___/
  • 24. CORE OPERATIONS •Downloads the recent version of WordPress to the current directory $wp core download
  • 25. CORE OPERATIONS •Creates WordPress configuration file. •This file tells WP-CLI how connect to you’re site’s database $wp core config
  • 26. DATABASE OPERATIONS •Create a database for your WordPress install •Depends on a wp-config.php file to work $wp db create
  • 27. CORE OPERATIONS •Completes the WordPress install process $wp core install
  • 28. INSTALL WORDPRESS # Download WordPress $wp core download # Create WordPress configuration - wp-config.php $wp core config —-dbuser=root --dbpass=root —-dbname=wpcli-test
  • 29. INSTALL WORDPRESS # Create Database for install $wp db create wpcli-test # Run the install process $wp core install —url=wpcli-test.dev —-title=“wpcli test” —admin_user=admin --admin_password=password --admin_email=info@example.com
  • 30. INSTALL WORDPRESS •Not needed if you’re using VVV •WP installs can be created and provisioned via Vagrant Note for VVV Users https://varyingvagrantvagrants.org/
  • 32.
  • 33. INSTALL A PLUGIN $wp plugin install wp-site-migrate —-activate
  • 34.
  • 35. _ _ _ / | | | | (_) / _ _ | |_ ___ _ __ ___ __ _ | |_ _ ___ _ __ / / | | | | | __| / _ | '_ ` _ / _` | | __| | | / _ | '_ / ____ | |_| | | |_ | (_) | | | | | | | | (_| | | |_ | | | (_) | | | | | /_/ _ __,_| __| ___/ |_| |_| |_| __,_| __| |_| ___/ |_| |_|
  • 36. SHELL SCRIPTING •You can use WP CLI with like any other command •e.g. tie commands together and run them as a list
  • 37. INSTALL WORDPRESS PLUGINS, THEME #!/bin/bash # list of plugins plugins=("user-switching" "debug-objects""wp-cfm") # loop through plugin list and install for plugin in ${plugins[*]}; do wp plugin install $plugin wp plugin activate $plugin done
  • 38. CREATE CHILD THEME wp scaffold child-theme generated-child-theme -- parent_theme=twentyseventeen --theme_name='Generated Child Theme' --activate
  • 39.
  • 40. INSTALL UNDERSCORE_S THEME #!/bin/bash # Installl _s theme with Unit Tests echo "Enter site name:" read theme_name wp scaffold _s $theme_name wp theme activate $theme_name wp scaffold theme-tests $theme_name
  • 41. GENERATE CONTENT wp any-ipsum generate-posts wp post generate --count=10 --post_type=page wp comment generate --count=10
  • 42.
  • 43.
  • 44.
  • 45. _____ _ _ _____ ______ _____ _ _ | __ | | | | | __ |____ | / ____| | | | | | |__) | | |__| | | |__) | / / | | | |__ ___ ___ | | __ | ___/ | __ | | ___/ / / | | | '_ / _ / __| | |/ / | | | | | | | | / / | |____ | | | | | __/ | (__ | < |_| |_| |_| |_| /_/ _____| |_| |_| ___| ___| |_|_
  • 46.
  • 47. PHP COMPATIBILITY COMMAND •Run PHP7 Compatibility Checker •Plugin needs to be installed •Version supplied as an argument wp phpcompat 7.0
  • 48. RUN PHP COMPATIBILITY CHECK SCRIPT #!/bin/bash wp plugin install php-compatibility-checker wp plugin activate php-compatibility-checker wp phpcompat 7.0 > php-compat-results.txt
  • 49. PLUGINS WITH COMMANDS •ACF •Elastic press •Migrate, migrated •caching plugins •PHP Compatibility •Regen thumbs •widget import/export •developer •wp-cfm •backupwordpress https://make.wordpress.org/cli/handbook/tools/
  • 50. _ _ / | | | | / __| | __ __ __ _ _ __ ___ ___ __| | / / / _` | / / / _` | | '_ / __| / _ / _` | / ____ | (_| | V / | (_| | | | | | | (__ | __/ | (_| | /_/ _ __,_| _/ __,_| |_| |_| ___| ___| __,_|
  • 51. SHELL ALIAS COMMAND Create a shortcut command for things that are frequently used to cut down on keystrokes. alias - show all aliases
  • 52. SHELL ALIASES Create an alias alias pu=“wp plugin update --all”
  • 53. SHELL ALIASES Remove an alias unalias pu
  • 54. SHELL ALIASES Arguments alias pi='wp plugin install’ pi wp-smushit
  • 55. SHELL ALIASES Aliases can be saved and managed from .bash_profile
  • 56. CUSTOM SHELL COMMANDS • functions can be created in your shell profile (.bash_profile) and executed globaly gen-content () { wp any-ipsum generate-posts wp comment generate --count=10 }
  • 57. WP-CLI is a toolbox Commands can be linked together via scripts to automate complex tasks
  • 58. WP-CLI for Themeing WP-CLI can be one of many tools to get your development process started quickly
  • 59. Good, Better, Best •Single Commands & Aliases •Shell Scripts •Custom Shell Commands
  • 60. Helpful Links Command Cookbook https://make.wordpress.org/cli/handbook/commands-cookbook/ Shell Friends https://make.wordpress.org/cli/handbook/shell-friends/ Plugins that work with WP-CLI https://make.wordpress.org/cli/handbook/tools/ WP-CLI Configuration https://make.wordpress.org/cli/handbook/config/ Shell Scripting https://www.shellscript.sh/ Advanced WordPress Management with WP-CLI https://www.smashingmagazine.com/2015/09/wordpress-management-with-wp-cli/