This is a modified Wordpress setup, inspired by Mark Jaquith's WordPress Skeleton package (hence the name). See the upstream documentation for base details.
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 local-config.php
.
Uploads live in the non-version controlled folder /media
in the root.
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
.
Important:
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.
Setting up the local development machine is easy:
-
Create a file in the root of the repository called
local-config.php
-
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. ?>
-
Modify
local-config.php
to match your MAMP settings
Note:
wp-config.php
is setup to contain all the production settings. Put all your settings for the production environment here.
- Make sure the folder
media
is present and has the right permissions (chmod 0700
). - It should work out of the box. If it doesn't, make sure your
UPLOADS
setting in yourwp-config
andlocal-config
is present and correct.
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
.
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 .gitmodule
:
ignore = dirty
Like this:
[submodule "wordpress"]
path = wordpress
url = git://github.com/WordPress/WordPress.git
ignore = dirty
- Use something like Yeoman for theme development to benefit of the joys of Coffee Script, SASS and more.
- Use the
WP_DEBUG
constant inlocal_settings.php
to load your javascript files infunctions.php
and one compressed javascript file on the production server. Seefunctions.php
for details. - Use Git Flow. Seriously, use it.
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.
Essential plugin
Helps with developing a good Wordpress Theme
This is an advanced caching plugin for Wordpress which supports asset compression to achieve something similar to Rails' assets pipeline. And of course more.
This plugin is like a swiss army knife.
Supports advanced tracking codes for GA.
For enhanced SEO.
Nifty little tool
- Abstract wp-config to support staging & production
- More plugins?