Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Yoav Farhi - Getting started with WP-CLI - WordCamp Athens 2016

Yoav Farhi - Getting started with WP-CLI - WordCamp Athens 2016

A717e9d055b2284e573b2412e32f5397?s=128

WordPress Greek Community

November 19, 2016
Tweet

More Decks by WordPress Greek Community

Other Decks in Programming

Transcript

  1. # Getting started with WP-CLI # WP-Athens 2016 Yoav Farhi

    @yoavf
  2. The original presentation was a live demo 
 
 The

    following slides are just a recap of the commands presented.
  3. # WP-CLI website ‣ open http://wp-cli.org

  4. # Download ‣ curl -O https://raw.githubusercontent.com/ wp-cli/builds/gh-pages/phar/wp-cli.phar

  5. # Mac Setup ‣ chmod +x wp-cli.phar ‣ sudo mv

    wp-cli.phar /usr/local/bin/wp
  6. # Test & list of commands ‣ wp

  7. # Download WordPress ‣ wp core download

  8. # wp-config.php creation ‣ wp core config
 --dbname=wpcli 
 --dbuser=root

    
 --dbpass=root 
 --dbhost=localhost 
 --dbprefix=wpcli_
  9. # Install ‣ wp core install 
 --url="http://wpcli.dev" 
 --title="WP-CLI

    Demo" 
 --admin_user=yoav 
 --admin_password=mypassword 
 --admin_email=yoav@farhi.org
  10. # Languages ‣ wp core language install el --activate ‣

    wp core language activate en_US
  11. # Updates ‣ wp core update

  12. # Packages ‣ wp package ‣ wp package list ‣

    wp package install
 aaemnnosttv/wp-cli-http-command
  13. # Import ‣ wp plugin install wordpress-importer 
 --activate ‣

    wp http get 
 https://wpcom-themes.svn.automattic.com/ demo/theme-unit-test-data.xml 
 --scheme=https 
 > theme-unit-test-data.xml ‣ wp import theme-unit-test-data.xml 
 --authors=create
  14. # Options ‣ wp option ‣ wp option update blogname

    "WordCamp Athens wp-cli demo"
  15. # Sticky posts option ‣ wp option get sticky_posts ‣

    wp option update sticky_posts [] 
 --format=json
  16. # Post ‣ wp post ‣ wp post generate --count=2

  17. # Post with external data ‣ wp http get http://loripsum.net/api/5

    
 | wp post generate 
 --post_content 
 --count=1
  18. # Search & replace ‣ wp search-replace Lorem WordPress

  19. # Scaffolding ‣ wp scaffold child-theme my-new-theme 
 --parent_theme=twentysixteen 


    --author_uri=http://yoav.fr 
 --activate
 ‣ wp scaffold _s iloveathens 
 --theme_name="I love Athens!" 
 --author="Yoav Farhi" 
 --sassify
  20. # Themes ‣ wp theme list ‣ wp theme activate

    twentyfourteen
  21. # Plugins ‣ wp plugin list ‣ wp plugin install

    jetpack --activate
  22. # Subcommands from plugins ‣ wp jetpack ‣ wp jetpack

    module list
  23. # Export / DB ‣ wp export ‣ wp db

    export l33t-backup.sql
  24. # Multisite ‣ wp core multisite-convert ‣ wp site create

    --slug=new-site ‣ wp theme activate twentyfourteen 
 --url=http://wpcli.dev/new-site
  25. Thanks Yoav Farhi @yoavf