WordPress Theme Updater SDK #
Integrate auto-updates into a WordPress theme using the native WordPress update system.
Files #
sdk/php/wordpress/class-dmsi-wp-theme-updater.php
sdk/php/examples/wordpress-theme.php
How It Works #
Similar to the plugin updater, but hooks into WordPress's theme update system (pre_set_site_transient_update_themes). When WordPress checks for theme updates, the Update Server is queried. Available updates appear in the standard Themes screen.
Basic Integration #
Add this code to your theme's functions.php:
require_once get_template_directory() . '/updater/class-dmsi-update-client.php';
require_once get_template_directory() . '/updater/class-dmsi-wp-theme-updater.php';
add_action('init', function() {
$client = new DMSI_Update_Client([
'api_url' => 'https://yoursite.com',
'product_id' => 55,
]);
$updater = new DMSI_WP_Theme_Updater([
'client' => $client,
'theme_slug' => 'your-theme',
'version' => wp_get_theme()->get('Version'),
'license_key' => get_option('your_theme_license_key', ''),
]);
$updater->init();
});
Constructor Options #
| Option | Required | Description |
|---|---|---|
client | Yes | DMSI_Update_Client instance |
theme_slug | Yes | Theme directory name (e.g., "your-theme") |
version | Yes | Currently installed version |
license_key | Yes | Customer's license key |
