Skip to content

Instantly share code, notes, and snippets.

@mavieth
Last active January 26, 2017 07:55
Show Gist options
  • Select an option

  • Save mavieth/009c8c2ae0dcb1cb6937bda7f66f67d0 to your computer and use it in GitHub Desktop.

Select an option

Save mavieth/009c8c2ae0dcb1cb6937bda7f66f67d0 to your computer and use it in GitHub Desktop.
function wordpress_defaults () {
cd $SITE_URL
SITES=~/Sites
FULLPATH=$SITES/$SITE_URL
WP_CONTENT=$FULLPATH/wp-content
THEMES_PATH=$WP_CONTENT/themes
PLUGIN_PATH=$WP_CONTENT/plugins
cd $PLUGIN_PATH
wp rewrite structure '/%postname%/' --hard
wp rewrite flush --hard
wp option update blog_public 0
wp option update posts_per_page 12
wp post delete $(wp post list --post_type=page --posts_per_page=1 --post_status=publish --pagename="sample-page" --field=ID --format=ids)
wp post delete 1
# wordpress.org Plugins
plugins=(
"force-regenerate-thumbnails"
"advanced-custom-fields"
"ewww-image-optimizer"
"wordpress-importer"
"google-analytics-dashboard-for-wp"
)
for i in "${plugins[@]}"
do
wp plugin install $i --activate
done
# Git Plugins
plugins=(
"https://github.com/wp-sync-db/wp-sync-db.git"
"https://github.com/wp-sync-db/wp-sync-db-media-files.git"
"https://github.com/roots/soil.git"
)
for plugin in "${plugins[@]}"
do
git clone $plugin
done
plugins=(
"wp-sync-db"
# "udinra-all-image-sitemap"
"wp-sync-db-media-files"
"soil"
)
for plugin in "${plugins[@]}"
do
wp plugin activate $plugin
done
wp plugin delete akismet
wp plugin delete hello
# Widgets to delete
deleteWidgets=(
"search-2"
"archives-2"
"recent-posts-2"
"recent-comments-2"
"meta-2"
"categories-2"
)
for widget in "${deleteWidgets[@]}"
do
wp widget delete $widget
done
# # Update WordPress Options
# # ------------------------------------------------------------------------------
# discourage search engines
wp option update blog_public 0
# show only 6 posts on an archive page
wp option update posts_per_page 12
wp rewrite structure '/%postname%/' --hard
wp rewrite flush --hard
allpages='Home,About,Contact,Blog'
# create all of the pages
export IFS=","
for page in $allpages; do
wp post create --post_type=page --post_status=publish --post_author=$(wp user get $wpuser --field=ID --format=ids) --post_title="$(echo $page | sed -e 's/^ *//' -e 's/ *$//')"
done
# Static front page and blog page
wp option update page_on_front 5
wp option update page_for_posts 9
wp option update show_on_front page
wp rewrite structure '/%postname%/' --hard
wp rewrite flush --hard
wp plugin delete akismet
wp plugin delete hello
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment