1. Home
  2. Knowledge Base
  3. Developer
  4. Example Theme Integration

Example Theme Integration

Download and include the license server client in your project. To integrate to a plugin, add the following lines to your plugin’s main file.

WC_Software_License_Client::get_instance(
	$license_server_url,
	$base_file,
	$software_type
);

$license_server_url – Is the domain of the license server.
$base_file – Is the plugin main file for a plugin or the theme root folder for the a theme.
$software_type – Specify if this is a plugin or theme, default is plugin.

First add the following code to your theme’s functions.php file.

function theme_slswc_client() {
    require_once 'includes/class-wc-software-license-client.php';
    return WC_Software_License_Client::get_instance(
	'http://example.com',
	WP_CONTENT_DIR . '/themes/theme-folder-name',
	'theme'
    );
}
add_action( 'wp_loaded', 'theme_slswc_client', 11 );

Remember to change ‘theme-folder-name’ with the actual name of the folder containing your theme’s style.css and functions.php files.

And then add the following to style.css

/*
Theme Name  : Theme Name
Theme URI   : https://example.test/themes/your-theme-name/
Author      : Author Name
Author URI  : https://example.test/
Description : Software License Server for WooCommerce Test Theme
Version     : 1.0
License     : GNU General Public License v2 or later
License URI : http://www.gnu.org/licenses/gpl-2.0.html
Tags        : blog, two-columns, left-sidebar
Text Domain : rigidtheme
SLSWC       : theme
Documentation URL: https://example.test/docs/rigid-theme
Tested WP   : 5.1
Requires WP : 5.1
*/
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support
Scroll to Top