Skip to content

Instantly share code, notes, and snippets.

@Twanneman
Forked from lucprincen/WP Setup bash
Last active August 29, 2015 14:06
Show Gist options
  • Save Twanneman/157b9d12f752cada5f97 to your computer and use it in GitHub Desktop.
Save Twanneman/157b9d12f752cada5f97 to your computer and use it in GitHub Desktop.
#!/bin/sh
cd ../your/staging/location
echo -e "\033[32m Downloading WordPress... "
echo -e "\033[0m"
printf "De url van deze site is: your/staging/location/..."
read NEWDIR
mkdir $NEWDIR
#Install WordPress and create the wp-config.php file...
#We add the --force so WP CLI doesn't get confused by some other wp version that might be running on this domain.
cd $NEWDIR
wp core download --force
echo -e "\033[32m WordPress Geinstalleerd... "
echo -e "\033[0m"
cd $NEWDIR
#add your customary gitignore-file:
git clone [email protected]:yourusername/.gitignore.git
cd wp-content
mkdir upgrade
mkdir uploads
cd plugins
echo -e "\033[32m Custom plugins toevoegen... "
echo -e "\033[0m"
#via een git repo:
git clone [email protected]:chefduweb/cuisine.git && rm -rf cuisine/.git
cd ../../
echo -e "\033[32m Database installeren... "
echo -e "\033[0m"
#custom prefix:
wp core config --dbname={VASTE DB NAAM} --dbuser={VASTE DB USER} --dbpass={VASTE DB PASS} --dbprefix=$NEWDIR"_"
wpurl='http://your.staging-server.com/'$NEWDIR
wpadminname='Username'
wpadminmail='[email protected]'
wpadminpassword='nonneyourbusiness'
printf "Wat is de titel van de site? "
read WPNAME
wp core install --url=$wpurl --title=$WPNAME --admin_name=$wpadminname --admin_email=$wpadminmail --admin_password=$wpadminpassword
echo -e "\033[32m Gebruikers maken & Plugins activeren... "
echo -e "\033[0m"
wp user create extra [email protected] --role=administrator
wp plugin activate cuisine
wp plugin install wordpress-seo
wp plugin activate wordpress-seo
echo -e "\033[32m Permalinks goedzetten... "
echo -e "\033[0m"
cat default_htaccess.txt | sed "s/{WP_DIR}/"$NEWDIR"/" > .htaccess
wp option update permalink_structure '/%postname%/'
echo -e "\033[32m Overige instelling... "
echo -e "\033[0m"
wp post update 2 --post_name=home --post_title=Home
wp option update page_on_front '2'
wp option update show_on_front 'page'
echo -e "\033[32m Git repo aanmaken... "
echo -e "\033[0m"
git init
git add .
git commit -m "Initiele setup"
echo -e "\033[32m WordPress installatie geslaagd! "
echo -e "\033[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment