Giter Site home page Giter Site logo

ajsb85 / theme-updater Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ucf/theme-updater

2.0 3.0 0.0 786 KB

A theme updater for GitHub hosted Wordpress themes. This Wordpress plugin automatically checks GitHub for theme updates and enables automatic install.

License: GNU General Public License v3.0

CSS 6.15% PHP 93.85%

theme-updater's Introduction

Wordpress plugin: a theme updater for GitHub-hosted Wordpress themes

Do you wish that you could somehow get update notifications within WordPress for custom themes that you use for your site? Perhaps a custom theme that you had developed specifically for your site? Or a theme you developed for a client site? And do you wish you could do "automatic updates" to those custom themes just like you can for public themes available from WordPress.org?

This WordPress plugin lets you host a custom theme in a Github public repository (private repos are not supported) and then notify sites when a new version of the theme is available. Those sites can then perform an auto-update just as with publicly available themes. The plugin also allows you to roll back to a previous version of the theme.

This plugin works with WordPress in both a standalone and MultiSite mode and has been tested up to WordPress 3.3.x. It can be found in the WordPress plugin directory at:

Bugs, feature requests or other suggestions should be filed as issues at the plugin's Github repository

Screenshots

Screenshot One


Screenshot Two


Screenshot Three


Installation

Here is a sample theme. Download (.zip)

1 - Publish your theme to a public GitHub Repository

2 - Update Your theme's style.css

Add Github Theme URI to your style.css header, this will be where the plugin looks for updates. I also recommend using semantic versioning for the version number. (Note that the version number does not need to start with "v" as shown in the examples below. You can simply use a number such as "1.2.0". You just need to be consistent with how you create version numbers.)

Example header:

Theme Name: Example  
Theme URI: http://example.com/  
Github Theme URI: https://github.com/username/repo
Description: My Example Theme
Author: person
Version: v1.0.0

Push these changes back to the project.

3 - Create a new tag and push the change back to the repo

$ git tag v1.0.0
$ git push origin v1.0.0

Note, your tag numbers and theme version numbers should match. If you want to increment the version number, be sure to update and commit your style.css prior to creating the new git tag.

4 - Upload your modified theme to your WordPress site

Before the plugin can work, your theme with the Github Theme URI addition needs to be uploaded to our WordPress site.

  • Create a ZIP file of your theme on your local computer.
  • Inside your WordPress admin menu (standalone) or network admin menu (MultiSite) go to the Install Themes panel and click on "Upload".
  • Choose your ZIP file and press "Install Now".

Your theme will now be installed inside of WordPress and can be activated for your site. From this point forward all updates will be installed automatically once the plugin is activated.

5 - Download and install the plugin

Inside your WordPress admin menu (standalone) or network admin menu (MultiSite) choose "Add New" under the Plugins menu. Search for "Theme Updater" and this will bring you to the plugin's WordPress page where you can install the plugin directly into your WordPress installation. (Alternatively you can visit that page, download the plugin as a zip file and upload it to your WordPress install, but why go through all that work?)

With the plugin installed and activated (it must be network activated on multisite installs) on your site and the theme uploaded, the next time you push a new tag to your Github repository, it will be recognized by the plugin and an update notice will appear in your admin menu.

This is no configuration or settings panel for this plugin.


Updating The Theme

The process of updating your theme and generating auto-update notifications is now simply this:

1 - Make your changes to the theme and commit those changes to your local git repository.

2 - IMPORTANT - Update your style.css file with a new version number and commit that change to your local repository.

3 - Push your changes to the Github repository

$ git push origin master

4 - Create a new tag and push the change back to the repo

$ git tag v1.1.0
$ git push origin v1.1.0

Note, you should use the identical number for the tag that you did for a version number in style.css in step #2.

That's it. Now any sites with your theme installed will receive an update notification the next time their WordPress installation checks for updates.


Code Comments

The flow of the plugin is:

1 - Get the Theme's Update URI

Code is a mashup of Wordpress source. I'm looking at:

2 - Get the github tags

Pull the tags trough the Repository Refs API.

3 - Notify Worpress of the Update

Publish the update details to the response array in the update_themes transient, similar to how Wordpress updates themes.

Changelog

*** v1.3.7 - July 23, 2012

  • URLencode repo and user names
  • Handle Github API errors appropriately

*** v1.3.6 - July 23, 2012

v1.3.5 - July 23, 2012

v1.3.4 - February 8, 2012

  • Fix to SSL issue. Code by Github user bainternet. Added by Github user danyork.

theme-updater's People

Contributors

beck avatar conover avatar danyork avatar ajsb85 avatar jslang avatar

Stargazers

Ismael IC avatar Andrew Sears avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.