Making update notification functionality for my themes

the question is simple 🙂 I am making a theme that i will use in lots of sites. So, i don’t want to go all the site and ftp the files every time i fix a bug or do a theme upgrade.

Is there any way i can make a update system like the plugins hosted in wordpress plugin directory.

Looking forward to your answer. Thanks!

Solved:

Thanks Chip Bennett for his excellent link. The update library for themes is now available in that site. You can find it here: http://w-shadow.com/blog/2011/06/02/automatic-updates-for-commercial-themes/

Always consider donation if you see some excellent work that made available for free.

Comments:


Answers:

You can also hook into the core update routine. (I’m looking for tutorial links, but my Google-fu is failing me this morning.)

EDIT:

See if this tutorial helps. It explains how to implement automatic upgrades for private/commercial (i.e. non-repository-hosted) Plugins.

Comments:
  • I think it is pre_set_site_transient_update_plugins
  • Thanks! I go through you link and the plugin codes did not worked but i request the guy for modifying the library for themes couple of days later he made one! And now its working great! I will put the link in my question. Thanks!!
  • Here is tutorial for automatic upgrades of themes also from the same site: w-shadow.com/blog/2011/06/02/…
  • pre_set_site_transient_update_plugins runs only the activated theme on main site. all other custom theme update will not be checked even if it is multi site and activated other custom theme on other sites.

An interest question! In fact, I think you should make a service to check update! Such as yourdomain.comn/api/update-check! Then this can return XML or JSON or some useful information related to update such as version, the url of update file (updated file should be a zip file)!

In your theme you can have:

    

So, when you detected an update from above url(yourdomain.comn/api/update-check), assume it returns JSO data as following: {"version":"1.2","file":"theme.zip"}

You compare version to check for new update! Then switch to default theme with this function http://codex.wordpress.org/Function_Reference/switch_theme (in order when users access the site, they see a worlking site)! Next, your code can use curl or even file_get_contents to download zip file (theme.zip in this case)! Next, you delete all file of in your theme folder, then extrat zip file and copy its content into theme folder! I think this way it should work!

You may want to take a look on what WordPress did! I found it's in file wp-admin/includes/update-core.php, line 288, function update_core

Comments:

You may also like...