1. Home
  2. Demi
  3. Developer Guide
  4. Premium Demos

Premium Demos

Demi allows theme developers to provide premium demos that are only accessible to verified users. This is useful when distributing paid themes or restricting certain demos to licensed customers.

Premium demos can be marked using the is_pro flag in your demo registration. By default, Pro demos are restricted, and users cannot import them unless access is explicitly granted.

You can control access to these demos using the demi_is_pro_demo_allowed filter hook.

Using Hook

The demi_is_pro_demo_allowed hook allows you to check whether a user is allowed to import a premium demo. You can validate this using:

  • A theme license status
  • A purchase code
  • Any other custom logic

Here is an example:

add_filter( 'demi_is_pro_demo_allowed',function ( $is_allowed, $slug, $demo_data ) {
$is_theme_licensed = get_option( 'my_theme_license_status' ) === 'active';
if ( $is_theme_licensed ) {
return true; // Allow import for licensed users
}
return $is_allowed; // Default is false for PRO demos
},10,3);

How This Works

  1. Filter Hook: demi_is_pro_demo_allowed passes three parameters:
    • $is_allowed – Boolean, default false for pro demos
    • $slug – Demo slug being imported
    • $demo_data – Full demo array from registration
  2. License Check: Inside the hook, you can check any condition you want (e.g., theme license, API validation).
  3. Return Value:
    • Return true if the demo import should be allowed.
    • Return $is_allowed (or false) to keep the demo restricted.

This ensures that only verified users can access premium demos, while free demos remain open to everyone.

Benefits for Theme Developers

  • Protect premium demo content from unauthorized use
  • Integrate with existing license or purchase code systems
  • Maintain a clean demo import experience for users
  • Combine with demi_import_demos to create a mix of free and pro demos

How can we help?