Home / eCommerce / Sample WordPress theme Software Licensing API implementation
Duplicate Snippet

Embed Snippet on Your Site

Sample WordPress theme Software Licensing API implementation

Sample EDD Software Licensing API integration: easily set your WordPress plugin up to work with the EDD SL SDK, to add automatic update and licensing checks.

Code Preview
php
<?php
/**
 * This is just a demonstration of how theme licensing works with
 * Easy Digital Downloads.
 *
 * @package EDD Sample Theme
 */
/**
 * Load theme updater functions.
 * Action is used so that child themes can easily disable.
 */
/**
 * Initialize the theme license handler and updater.
 *
 * This registry handles activating and deactivating the license key,
 * as well as checking for updates to the theme.
 */
add_action(
	'edd_sl_sdk_registry',
	function ( $init ) {
		$init->register(
			array(
				'id'      => 'edd-sample-theme',
				'url'     => 'https://edd.local',
				'item_id' => 36894,
				'version' => '1.0.0',
				'file'    => __FILE__,
				'type'    => 'theme',
			)
		);
	}
);
if ( file_exists( __DIR__ . '/vendor/easy-digital-downloads/edd-sl-sdk/edd-sl-sdk.php' ) ) {
	require_once __DIR__ . '/vendor/easy-digital-downloads/edd-sl-sdk/edd-sl-sdk.php';
}

Comments

Add a Comment