Auto Update Self Hosted WordPress Themes

Having visited WordCamp UK over the weekend of the 14th and 15th of July in Edinburgh one of the talks spurred me on into thinking about my development environment and how I could improve it. The talk in question was “Totally Custom Theme Development” and was a panel discussion on how we develop themes etc. for clients.

Steve Taylor, Jonny Allbut and Rachel McCollin chaired the panel although there was a lot of audience contribution to the discussions. Essentially it came down to how we add common functionality to our themes. Most of use tend to use a theme to start with that is the same, and will contain a bunch of code that enables certain things in your site. Therefore the debate was had around either putting all this into a plugin or using a parent theme.

Previous to the debate I have used a start theme which I had developed over time. I then changed and altered this theme according to the site that I was building at the time. Jonny pointed out that this is often not the best way of doing things because if you wanted to update some of the functionality that you have in the starter theme it would mean updating all the sites that we built using that manually. Jonny’s workflow was to use a parent theme, in his case the Wonderflux theme framework and then build child themes off of that. That way if you starter functionality changes (in this case the parent theme) you need only to update each parent theme of all your sites. This works although still requires manual uploading of the parent theme on every site. The reason for this is that because the parent or starter theme is not in the WordPress theme repository then the auto update feature is not available.

This got me thinking about whether or not you could make themes (and plugins for that matter) auto update and get the updated version from another location rather than the WordPress theme repository. Then I thought about premium plugins such as Gravity Forms. These plugins are not in the WordPress plugin repository because you have to pay for them, however they still allow auto updates.

At this point I started searching the web for the solution to this problem and how to get themes auto updating from a set location. This is when I came across this Github project from Jeremy Clark. Jeremy has developed a handy chunk of code to do precisely this.

The instructions are very clear and having implemented this I can now host my own theme updates. When I make an update available on my server all of the sites that are using that theme as a parent theme will see the update in the WordPress dashboard and therefore they can auto update to take advantage of the new functionality or bug fixes. As long as the sites are running child themes then they should work just fine.

I am going to give this a go in my next project and see if it works as a development work flow. I have never been a fan of parent and child themes as my child theme always end up with lots of files that will not get updated when the parent theme is updated and therefore ruining the very idea of parent and child themes. Time will tell I suppose and I will blog again with my thoughts on the outcome.

Using P2 Theme for a Development Log

Over at Pixel Junction Creative we have a number of developers and designers working on projects together and we were getting increasingly frustrated with having to email each other all the time to keep everyone up-to-date and in the loop with what was going on. To get around this I came across the P2 WordPress theme developed by Automattic. This has provided a great solution to our needs and I wanted to talk about how we have implemented the theme in order to create a development log.

P2 is a theme for WordPress that transforms a mild-mannered blog into a super-blog with features like inline comments on the homepage, a posting form right on the homepage, inline editing of posts and comments, real-time updates so new posts and comments come in without reloading, and much more.

Having downloaded and installed the theme it was clear that it was almost as we required it, but as always these things always need a few custom bells and whistles to make them just as you want them. In this case most of the changes were in terms of design, but functionality could change too.

[wpvideo YYNW9iSj w=610 h=343]

To go about making the changes I decided that the best way forward would be to create a child theme, based on the main P2 theme. This child theme would then be used for the development log site. The child theme being used simply contains a stylesheet (style.css) and functions file (functions.php) and a screenshot (screenshot.png).

The stylesheet is where the design changes come into play although the P2 Theme has many options in the backend in order to change various elements such as the header and the colours etc. The functions file was necessary to add some functionality that was not present in the theme itself. The main change in functionality is that I wanted to make the entire site accessible to logged in, registered users only. To do this I used my own Logged In Users Only Plugin. This code went straight into the functions file rather than having to activate a plugin, that way once the theme was active the site would always be protected to logged in users only.

The other code that was added to the functions file was simply some code to remove some of the menus from the dashboard to make it more foolproof for all the non WordPress designers and developers

The benefits of the P2 theme are great. We can track the development of projects by tagging the project with each update as well as keeping a track of all documents for a particular project as these can be uploaded from the front end just the same as posting. It also enables us to see a history of the development of the project as all the discussion can be seen by clicking on the specific tag for a project.

Once addition that we have made is to add to the log the Email Alerts plugin. This plugin sends email alerts to all registered users that have selected this option on their profile page for both comments and posts. This enables all the developers and designers to keep track of when the log has been updates and when they need t check it etc.

This is a really good solution to the problem of collaboration between a number of people and works very well. With a few minor alteration here and there we now have a fully function development log for keeping track of the different projects that everyone is working on.