Skip to content

Instantly share code, notes, and snippets.

@samikeijonen
Created December 19, 2012 11:25
Show Gist options
  • Save samikeijonen/4336043 to your computer and use it in GitHub Desktop.
Save samikeijonen/4336043 to your computer and use it in GitHub Desktop.
EDD license in functions.php inside setup function.
<?php
/* Add theme settings. */
if ( is_admin() )
require_once( trailingslashit ( get_template_directory() ) . 'admin/functions-admin.php' );
/* Set up Licence key for this theme. URL: https://easydigitaldownloads.com/docs/activating-license-keys-in-wp-plugins-and-themes */
// this is the URL our updater / license checker pings. This should be the URL of the site with EDD installed.
define( 'KULTALUSIKKA_SL_STORE_URL', 'http://localhost/foxnet-themes-shop' ); // add your own unique prefix to prevent conflicts
// the name of your product. This should match the download name in EDD exactly.
define( 'KULTALUSIKKA_SL_THEME_NAME', 'Kultalusikka' ); // add your own unique prefix to prevent conflicts
/* Define current version of Kultalusikka. Get it from parent theme style.css. */
$kultalusikka_theme = wp_get_theme( 'kultalusikka' );
if ( $kultalusikka_theme->exists() ) {
define( 'KULTALUSIKKA_VERSION', $kultalusikka_theme->Version ); // Get parent theme Kultalusikka version
}
if( !class_exists( 'EDD_SL_Theme_Updater' ) ) {
// load our custom theme updater
include( dirname( __FILE__ ) . '/includes/EDD_SL_Theme_Updater.php' );
}
// Get license key from database.
$kultalusikka_get_license = get_option( $prefix . '_theme_settings' ); // This is array.
$kultalusikka_license = $kultalusikka_get_license['kultalusikka_license_key'];
$edd_updater = new EDD_SL_Theme_Updater( array(
'remote_api_url' => KULTALUSIKKA_SL_STORE_URL, // our store URL that is running EDD
'version' => KULTALUSIKKA_VERSION, // the current theme version we are running
'license' => $kultalusikka_license, // the license key (used get_option above to retrieve from DB)
'item_name' => KULTALUSIKKA_SL_THEME_NAME, // the name of this theme
'author' => 'Sami Keijonen' // the author's name
)
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment