This is a modified Wordpress setup, inspired by Mark Jaquith's WordPress Skeleton package (hence the name). See the upstream documentation for base details.
How it works
Wordpress is included as a Git Submodule, this makes sure that Wordpress is always up to date. All the content (themes, plugins, languages etc) live in their own, version controlled, directory 'content'. Configuration of this is done in
wp-config.php. Local settings are stored in the not version controlled
Uploads live in the non-version controlled folder
/media in the root.
Fetch the submodules
After cloning this repository, fetch the Wordpress submodule by doing so:
git submodule init and then
git submodule update.
cd into wordpress and checkout the version you desire. For instance
git checkout 3.5.1.
Don't forget to tell git in the parent repository you've checked out a different tag. Fortunately, that's very easy.
cd into the root of your project and hit
git submodule update again.
Setup the local environment
Setting up the local development machine is easy:
Create a file in the root of the repository called
Copy the following contents in to that file:
<?php define( 'WP_LOCAL_DEV', true ); define( 'WP_DEBUG', true ); define( 'DB_NAME', 'your_database_name' ); define( 'DB_USER', 'root' ); define( 'DB_PASSWORD', 'root' ); define( 'DB_HOST', 'localhost' ); // Probably 'localhost' define( 'HOST', 'localhost' ); // Probably 'localhost' too, be sure to include the port if it's other than 80 in your setup. define( 'SITE_PATH', 'your_path/your_subfolder'); // the path to the root of your project, relative to the hostname aka the part of the url that comes after the hostname. Don't use a leading /. define( 'WP_HOME', 'http://'. HOST .'/'. SITE_PATH); define( 'WP_SITEURL','http://'. HOST .'/'. SITE_PATH .'/wordpress'); define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/content' ); define( 'WP_CONTENT_URL', 'http://'. HOST .'/'. SITE_PATH .'/content' ); define( 'UPLOADS', '../media/uploads' ); // make sure this is relative to the root of your site path and not to your /wordpress folder. ?>
local-config.phpto match your MAMP settings
wp-config.php is setup to contain all the production settings. Put all your settings for the production environment here.
Setup the media folder
- Make sure the folder
mediais present and has the right permissions (
- It should work out of the box. If it doesn't, make sure your
UPLOADSsetting in your
local-configis present and correct.
Development vs. Production/Staging
Wordpress stores a lot of it's settings in the database, and to make things worse, each plugin uses their own way of storing that information too. There isn't really a best practice of syncing these settings, if you do know, please contribute!
Since Wordpress is a submodule synced with the Wordpress Github repository, you do not need to update Wordpress from the Wordpress Admin. Instead, update the submodule and checkout the tag of the latest (stable) Wordpress version. If you like to live on the edge, switching to a nightly build is as easy as
git checkout master.
Problems commiting/updating after updating Wordpress?
It probably has something to do with modified Wordpress files in the Wordpress folder. Check those first, stash your changes and checkout the latest stable Wordpress version.
Since Git 1.7.0 modified submodules are tagged as 'dirty' and thus making it almost impossible to merge. Fortunately, there is an easy fix:
Add the following line to each module in
ignore = dirty
[submodule "wordpress"] path = wordpress url = git://github.com/WordPress/WordPress.git ignore = dirty
Tips & Recommendations
- Use something like Yeoman for theme development to benefit of the joys of Coffee Script, SASS and more.
- Use the
- Use Git Flow. Seriously, use it.
Features & Plugins
Comes preloaded with some handy code snippets.
Comes with the default Wordpress styles necessary for displaying content right
Comes preset with default ignores for uploads, wordpress system files, cache folders, sass-cache, DS_Store and more. Modify this to suit your needs obviously.
Helps with developing a good Wordpress Theme
W3 Total Cache
This is an advanced caching plugin for Wordpress which supports asset compression to achieve something similar to Rails' assets pipeline. And of course more.
Advanced Custom Fields
This plugin is like a swiss army knife.
Google Analytics for Wordpress
Supports advanced tracking codes for GA.
Google Sitemap Generator
For enhanced SEO.
Broken Link Checker
Nifty little tool
- Abstract wp-config to support staging & production
- More plugins?