Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save itcxua/a3dc003bb38ad78c97de1ef3d45d84e6 to your computer and use it in GitHub Desktop.

Select an option

Save itcxua/a3dc003bb38ad78c97de1ef3d45d84e6 to your computer and use it in GitHub Desktop.

Revisions

  1. @petertwise petertwise revised this gist Apr 15, 2016. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions wp-cli-oneclick-install.sh
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,13 @@ read -p 'Site URL (example.com): ' url
    read -p 'Site Title: ' title
    read -p 'WP Admin username: ' admin_user
    read -sp 'WP Admin password: ' admin_password
    read -p 'WP Admin email: ' admin_email
    read -p '
    WP Admin email: ' admin_email
    read -p 'Database name: ' dbname
    read -p 'Database user: ' dbuser
    read -sp 'Database password: ' dbpass
    read -p 'Database prefix (wp_): ' dbprefix
    read -p '
    Database prefix (wp_): ' dbprefix
    read -p 'Theme Slug: ' themeslug
    read -p 'Theme Full Name: ' themename

  2. @petertwise petertwise revised this gist Apr 15, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wp-cli-oneclick-install.sh
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ wp plugin install square-candy-tinymce-reboot acf-field-date-time-picker disable
    wp plugin activate square-candy-tinymce-reboot disable-comments ajax-thumbnail-rebuild custom-post-type-ui post-thumbnail-editor wordpress-seo

    # download and install ACF pro
    wget -O acfpro.zip "http://connect.advancedcustomfields.com/index.php?p=pro&a=download&k=b3JkZXJfaWQ9NTk4Mjh8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE1LTA3LTEyIDAyOjU0OjEx"
    wget -O acfpro.zip "http://connect.advancedcustomfields.com/index.php?p=pro&a=download&k=[REDACTED]"
    wp plugin install acfpro.zip
    rm acfpro.zip

  3. @petertwise petertwise revised this gist Apr 15, 2016. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions wp-cli-oneclick-install.sh
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ echo Ok. Starting installation of $title on $url.
    # download, configure and install
    wp core download
    wp core config --dbname=$dbname --dbuser=$dbuser --dbpass=$dbpass --dbprefix=$dbprefix
    wp core install --url=$url --title=$title --admin_user=$admin_user --admin_password=$admin_password --admin_email=$admin_email
    wp core install --url=$url --title="$title" --admin_user=$admin_user --admin_password=$admin_password --admin_email=$admin_email

    # delete default installed plugins and themes we don't need
    wp plugin delete hello-dolly akismet
    @@ -33,7 +33,7 @@ wp plugin install acfpro.zip
    rm acfpro.zip

    # generate a new underscores (_s) theme
    wp scaffold _s $themeslug --theme_name=$themename --author="Square Candy" --author_uri="http://squarecandy.net"
    wp scaffold _s $themeslug --theme_name="$themename" --author="Square Candy" --author_uri="http://squarecandy.net"
    wp theme activate $themeslug

    # delete all the default sidebar widgets
    @@ -57,6 +57,8 @@ wp option update timezone_string "America/New_York"
    wp option update blog_public "on"
    # update the permalink structure
    wp rewrite structure '/news/%postname%/' --hard
    # make all comments disabled
    wp option update disable_comments_options --format=json '{"disabled_post_types":["post","page","attachment"],"remove_everywhere":true,"permanent":false,"extra_post_types":false,"db_version":6}'

    # create the main menu and assign it to the primary menu slot
    wp menu create "Main Menu"
  4. @petertwise petertwise created this gist Mar 22, 2016.
    65 changes: 65 additions & 0 deletions wp-cli-oneclick-install.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,65 @@
    #!/bin/bash
    # Install Wordpress with Square Candy default using WP CLI
    read -p 'Site URL (example.com): ' url
    read -p 'Site Title: ' title
    read -p 'WP Admin username: ' admin_user
    read -sp 'WP Admin password: ' admin_password
    read -p 'WP Admin email: ' admin_email
    read -p 'Database name: ' dbname
    read -p 'Database user: ' dbuser
    read -sp 'Database password: ' dbpass
    read -p 'Database prefix (wp_): ' dbprefix
    read -p 'Theme Slug: ' themeslug
    read -p 'Theme Full Name: ' themename

    echo Ok. Starting installation of $title on $url.

    # download, configure and install
    wp core download
    wp core config --dbname=$dbname --dbuser=$dbuser --dbpass=$dbpass --dbprefix=$dbprefix
    wp core install --url=$url --title=$title --admin_user=$admin_user --admin_password=$admin_password --admin_email=$admin_email

    # delete default installed plugins and themes we don't need
    wp plugin delete hello-dolly akismet
    wp theme delete twentyfourteen twentyfifteen

    # install our favorite plugins - activate the ones usually used in development
    wp plugin install square-candy-tinymce-reboot acf-field-date-time-picker disable-comments ajax-thumbnail-rebuild custom-post-type-ui post-thumbnail-editor wordfence wp-super-cache wordpress-seo
    wp plugin activate square-candy-tinymce-reboot disable-comments ajax-thumbnail-rebuild custom-post-type-ui post-thumbnail-editor wordpress-seo

    # download and install ACF pro
    wget -O acfpro.zip "http://connect.advancedcustomfields.com/index.php?p=pro&a=download&k=b3JkZXJfaWQ9NTk4Mjh8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE1LTA3LTEyIDAyOjU0OjEx"
    wp plugin install acfpro.zip
    rm acfpro.zip

    # generate a new underscores (_s) theme
    wp scaffold _s $themeslug --theme_name=$themename --author="Square Candy" --author_uri="http://squarecandy.net"
    wp theme activate $themeslug

    # delete all the default sidebar widgets
    wp widget delete search-2 recent-posts-2 archives-2 categories-2 meta-2

    # delete the example post and example page
    wp post delete 1 2 --force
    # make a new page for the homepage and blog page
    wp post create --post_type=page --post_title='Home' --post_status='publish'
    wp post create --post_type=page --post_title='News' --post_status='publish'
    # make those two pages the default for Home and Blog
    wp option update show_on_front "page"
    wp option update page_on_front "4"
    wp option update page_for_posts "5"

    # clear out "Just Another WordPress Blog" BS
    wp option delete blogdescription
    # set the timezone
    wp option update timezone_string "America/New_York"
    # we're usually starting with a development site - hide it from search engines
    wp option update blog_public "on"
    # update the permalink structure
    wp rewrite structure '/news/%postname%/' --hard

    # create the main menu and assign it to the primary menu slot
    wp menu create "Main Menu"
    wp menu location assign main-menu primary
    wp menu item add-post main-menu 4 --title="Home"
    wp menu item add-post main-menu 5 --title="News"