Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/medfreeman/wp-github-updater
Wordpress plugin that enables automatic updates of plugins and themes from github
https://github.com/medfreeman/wp-github-updater
Last synced: about 2 months ago
JSON representation
Wordpress plugin that enables automatic updates of plugins and themes from github
- Host: GitHub
- URL: https://github.com/medfreeman/wp-github-updater
- Owner: medfreeman
- License: gpl-3.0
- Created: 2016-08-16T10:16:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-06T00:19:15.000Z (over 8 years ago)
- Last Synced: 2024-10-10T16:41:53.918Z (3 months ago)
- Language: PHP
- Size: 38.1 KB
- Stars: 4
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wp-github-updater
[![Travis Build Status](https://img.shields.io/travis/medfreeman/wp-github-updater.svg?label=build)](https://travis-ci.org/medfreeman/wp-github-updater)Wordpress plugin that enables automatic updates of plugins and themes from github
## Installation
Download latest zip archive and decompress into your wordpress plugins folder, then activate.## Usage
- Host your plugin or theme on github
- Make sure your plugin php file or your theme style.css file has its Plugin URI or Theme URI entry set to a github repository url (e.g. https://github.com/me/my-wp-plugin-or-theme)
- Tag the plugin or theme versions you want to be proposed as updates, *ONLY* use version numbers as tags (e.g. 1.2.0), an update will show if this version is higher than the one currently instaled (as set in current Version tag in plugin php or theme style.css file)
- Make releases from your tags (if done manually, you have to add release notes to your tag on github so it becomes a release)
- If needed you can add a github release asset to your release, it will be installed instead of your plugin or theme source code (e.g. your repository has install tasks, dependencies that have to be built by a CI system or manually)### For plugins
Add the following code to your plugin main php file (this example is for use with a plugin class, adapt for another structure):
````
...class myplugin {
...
function __construct() {
...
add_action( 'admin_init', array( $this, 'handle_github_update' ) );
...}
...
/**
* Handles github plugin update by using
* github updater class from wp-github-updater plugin.
*/
function handle_github_update() {
if ( class_exists( 'GitHubUpdater' ) ) {
new GitHubUpdater( 'plugin', __FILE__ );
}
}
...}
````### For themes
Add the following code to your theme functions php file (make sure the second argument to GitHubUpdater class instantiation points to your theme root, e.g. \__DIR\__ if your functions.php file is in the root of your theme, adapt if not):
````
...add_action( 'admin_init', 'myprefix_handle_github_update' );
...
if ( ! function_exists( 'myprefix_handle_github_update' ) ) {
/**
* Handles github theme update by using
* github updater class from wp-github-updater plugin.
*/
function myprefix_handle_github_update() {
if ( class_exists( 'GitHubUpdater' ) ) {
new GitHubUpdater( 'theme', __DIR__ );
}
}
}
````That's all folks!