I have a client's theme currently hosted on github. Instead of doing a git deploy or using a service like Beanstalk's deployments. I will be pushing the same theme across many sites (79 to be exact) and want them to be able to update themselves just like a WP repo hosted theme. A good example is how the Genesis framework has it's updates work. I've seen things where you have another plugin installed to do this, but i'm looking for a more minimalist solution (if there is anyway to keep this functionality within the theme itself)?
There're a couple of libraries out there. One of the more well known is from Joey Kudish and hosted on GitHub itself.
Basically it does the following:
- utilizes the GitHub API
- Adds a callback to the
- Adds another callback to the
- finally utilizes the WP HTTP API and does a
wp_remote_get()to the GitHub repo.
Oh, yes - close to have forgotten this - it adds a transient to avoid checking the remote repo on every request.
You need 2 basic things to accomplish this
- Hook into
- Use the HTTP API to query whatever url has your update
The basic premise is your theme's version is stored in a transient that checks a remote URL every x hours and compares the
The URL can be anything, the HTTP API supports authentication (private repo) or anything you want to send via the header.
The check can be any variable comparison, though typically you use a version.
The file can be anything that can be parsed (.xml, .txt) but typically you use the
Instead of me adding code to this check this out: https://github.com/jeremyclark13/automatic-theme-plugin-update , specifically the theme part.