What you get is a WordPress repo starter kit. WordPress is in a subdirectory (/wp/), content is in a custom directory (/content/), and uploads are mapped to /shared/content/uploads/, which is a Git-ignored location. Re-symlink as appropriate, or alter your deploy script to do the symlinking on the fly.

You get a nice clean wp-config.php with a few of my tips and tricks already implemented (like local-config.php support for local development). .htaccess is ready to go with WordPress rewrite rules for anyone running on Apache.

I don’t really expect people to use it exactly the way I have it set up (though feel free!). What’s more likely is that people will fork it, and then make it their own. For instance, you may want to add mu-plugins drop-ins that you frequently use. Have fun!

Related

Post navigation

53 thoughts on “WordPress Skeleton”

Just found the repo, even before seeing this post – forked and downloaded. This is something I’ve been thinking on for a while; I already version my themes, but wondered if it would make sense to keep the whole shebang – WordPress core, themes, plugins – in one place to minimize the deploy process. Love the local-config.php idea, managing different setups can be a right pain at times.

I’ve seen you describe this on various posts or comments previously and this is very useful.

You could think about providing a local-config-example.php file which is meant to demonstrate what someone might put in that file. This is the way the Rails framework does it.

In my similar setup, I have a wp-config.php file that includes in a credentials file which is symlinked similarly to the uploads directory that you mentioned.

Having come to WordPress development from Rails, I’ve been wondering if the WordPress community had a similar Capistrano deployment approach. However, very few talk much about it. Would you say that most people default to Cowboy Coding?

I have visions of writing some additional scripting support which enables me to spin up a site, a few essential plugins (with preferred settings), and even some default page/post content. Having this kind of automation would save me a ton of time and assure a higher quality baseline site.

Anyway, thanks for putting this inspiration out there for the rest of us.

I noticed you have /sql-dump-*.sql and /db-sync in your .gitignore file. Could you explain your process for migrating the database from local to a development server? This has been my biggest problem with this workflow.
I have currently been using a plugin like WP-Migrate-DB, then importing it via PHPMyAdmin on each push where content has changed. I feel like this could be automated but I’m not sure how.

I had to add the following to wp-config.php to get wp-admin working somewhat normally:
define(‘WP_SITEURL’, ‘http://’ . $_SERVER[‘SERVER_NAME’] . ‘/wp’);
define(‘WP_HOME’, ‘http://’ . $_SERVER[‘SERVER_NAME’]);

Very interesting Mark, thanks for posting! Could you also share your capistrano tasks with us? Do you use railsless-deploy and the capistrano multistage extension? I’m also very interested to see what you actually do with the WP_STAGE and STAGING_DOMAIN constants? What is your process when you have to migrate a WordPress site from one domain to another (e.g. staging to production)?

I was just thinking after reading a recent article on “using relative URLs in WordPress[1]” if it would be possible to use this method to mitigate the problem of absolut URLs in the database when migrating across domains?

Thanks for sharing. Will likely use this for WordPress repos moving forward. I am especially interested in the environment configurations. I gave a talk on this at WordCamp Chicago 2011 – http://bit.ly/NbnlFP. Excited to see someone so close to WordPress Core doing the same.

As a self-affirmed cowboy coder with very little Git experience, is there anyone out there that can point me to a step-by-step resource to actually using this in a day-to-day project? I just grasp how this actually .. uh.. works?

Hi Mark. First off, thanks for this, it looks like an ideal setup. Unfortunately I am not being able to make it work correctly, not even locally.

What I did was this
1) I created the ‘wp-skeleton-test’ database locally
2) Under ‘localhost/wp-skeleton-test’ I used a standard wordpress package to populate the database
3) I then emptied the local ‘wp-skeleton-test’ directory and I added your wordpress skeleton
4) I created local-config.php and added the database details

Browsing the website works perfectly (index.php includes wp-blog-header.php and everything works from there on), but trying to login ad admin always redirects back to the home page.

I’m not even confident that the 3 steps process I used was the right one. If it was then I have no idea why this setup won’t let me login.

This is great stuff, I was trying to find a decent git/deploy setup myself last week, and I’m glad I found this setup, it looks great.

One other thing I’m trying to achieve, is to run multiple sites on a single directory containing WordPress, instead of having a seperate wp directory for each site. I got this working by using a symlink where you have the wp directory in your setup, pointing to the wp folder elsewhere on my server. This resulted in WordPress thinking it wasn’t installed, since it couldn’t find the “level up” wp-config.php (require_once uses the absolute path). However, this seems to be fixed easily by creating a wp-config.php in the wp directory with just this line of code:

Also, working with symlinks, WP updates can be done absolutely instantaneously; all you have to do is change the symlink. You can even centralize this by using this setup:

I’m really keen to start using WP Skeleton, but I’m having some set up issues.

I’ve zipped and installed WordPress Skeleton into a local folder ‘/vcip.com’. I have set it up as a local Git repo. I then created a database and user and added the info to local-config.php. I also generated and added the salts.

“uploads are mapped to /shared/content/uploads/, which is a Git-ignored location”

Why don’t you submit your images to version control? Does git not play well with binaries?
Perhaps I’m missing something, but adding your ‘uploads’ folder in the repo seems like a handy way of keeping your local/production sites in sync. How else would you upload images to the live server?

Git does not play well with binaries. And putting uploads into version control would be really confusing (and kind of pointless, because there is image data in the database which isn’t in version control).

ok, got it, hadn’t thought about it like that until now. Thanks Mark. What do you think is the best way of keeping your uploads in sync? I develop my sites locally in MAMP so I could just use the sync feature in Transmit.

Do you know of anyway to add a custom default WP themes directory repoas a sub-submodule into the WP submodule that you have here? (I delete the default wp-content/themes directory and clone my own themes repo instead).

The end goal is to create a single repo that includes your WP Skeleton, the WP SVN submodule, my usual mu-plugins submodule, and my usual themes submodule. Ideally, each of these things would be easily updatable with a simple git recursive update (or clone).

I just discovered this via another blog post of yours, and wanted to maybe sync up sometime. Since local development never seems to match production (and WordPress by design has no concept of mixed environments), I created something similar:

The value prop is creating a Vagrant VM with a working WordPress install that can be deployed & synced easily, so you always work on local, test on stage, and push to prod, rather than editing themes & plugins on prod (as most people seem to do).

This this is *extremely* daunting and forcing architecture into something that, by design, doesn’t really seem ready for it, I’m moved off the project onto other ones… I would still like to talk or maybe leverage your services in regards to a git-driven WordPress workflow!

Hmm it seems like your blog ate my first comment (it was super long)
so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog.
I too am an aspiring blog blogger but I’m still new to the whole thing. Do you have any helpful hints for beginner blog writers? I’d definitely appreciate
it.

Ask a WordPress Dev

Do you have an interesting WordPress-related question? Submit your questions, and I'll periodically pick the best one and answer it here on my blog! It can be anything from usage tips to hardcore WP development questions.