Skip to content

Instantly share code, notes, and snippets.

@vovafeldman
Created October 29, 2018 08:51
Show Gist options
  • Save vovafeldman/e81c4726115eef7406da9dc9ccd01785 to your computer and use it in GitHub Desktop.
Save vovafeldman/e81c4726115eef7406da9dc9ccd01785 to your computer and use it in GitHub Desktop.
How to merge free and premium version into one with Freemius
<?php
/**
* Plugin Name: ...
* Plugin URI: ...
* ...
*
* @fs_premium_only /path/to/premium/folder/
*/
// Freemius Init SDK code
function my_fs() {
global $my_fs;
if ( ! isset( $my_fs ) ) {
// Include Freemius SDK.
require_once dirname(__FILE__) . '/freemius/start.php';
$my_fs = fs_dynamic_init( array(
...
) );
}
return $my_fs;
}
if ( ! my_fs()->is_premium() ) {
require_once dirname(__FILE__) . 'path/to/free/loader.php';
}
if ( my_fs()->is__premium only() ) {
if ( my_fs()->can_use_premium_code() ) {
require_once dirname(__FILE__) . 'path/to/premium/loader.php';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment