$30 off During Our Annual Pro Sale. View Details »

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

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

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

    View Slide

  2. The original presentation was
    a live demo


    The following slides are just a recap of the commands presented.

    View Slide

  3. # WP-CLI website
    ‣ open http://wp-cli.org

    View Slide

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

    View Slide

  5. # Mac Setup
    ‣ chmod +x wp-cli.phar
    ‣ sudo mv wp-cli.phar /usr/local/bin/wp

    View Slide

  6. # Test & list of commands
    ‣ wp

    View Slide

  7. # Download WordPress
    ‣ wp core download

    View Slide

  8. # wp-config.php creation
    ‣ wp core config

    --dbname=wpcli 

    --dbuser=root 

    --dbpass=root 

    --dbhost=localhost 

    --dbprefix=wpcli_

    View Slide

  9. # Install
    ‣ wp core install 

    --url="http://wpcli.dev" 

    --title="WP-CLI Demo" 

    --admin_user=yoav 

    --admin_password=mypassword 

    [email protected]

    View Slide

  10. # Languages
    ‣ wp core language install el --activate
    ‣ wp core language activate en_US

    View Slide

  11. # Updates
    ‣ wp core update

    View Slide

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

    aaemnnosttv/wp-cli-http-command

    View Slide

  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

    View Slide

  14. # Options
    ‣ wp option
    ‣ wp option update blogname "WordCamp Athens
    wp-cli demo"

    View Slide

  15. # Sticky posts option
    ‣ wp option get sticky_posts
    ‣ wp option update sticky_posts [] 

    --format=json

    View Slide

  16. # Post
    ‣ wp post
    ‣ wp post generate --count=2

    View Slide

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

    | wp post generate 

    --post_content 

    --count=1

    View Slide

  18. # Search & replace
    ‣ wp search-replace Lorem WordPress

    View Slide

  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

    View Slide

  20. # Themes
    ‣ wp theme list
    ‣ wp theme activate twentyfourteen

    View Slide

  21. # Plugins
    ‣ wp plugin list
    ‣ wp plugin install jetpack --activate

    View Slide

  22. # Subcommands from plugins
    ‣ wp jetpack
    ‣ wp jetpack module list

    View Slide

  23. # Export / DB
    ‣ wp export
    ‣ wp db export l33t-backup.sql

    View Slide

  24. # Multisite
    ‣ wp core multisite-convert
    ‣ wp site create --slug=new-site
    ‣ wp theme activate twentyfourteen 

    --url=http://wpcli.dev/new-site

    View Slide

  25. Thanks
    Yoav Farhi
    @yoavf

    View Slide