The WPML Installer helps theme and plugin authors provide multilingual-ready themes and plugins to their clients. A tiny chunk of PHP code will offer your clients the option to buy, install, and activate WPML right from within your theme.
Here are the advantages of adding WPML’s Installer to your theme or plugin:
- It is solid proof to your clients that your theme or plugin is multilingual-ready and fully compatible with WPML
- Provide your clients with an easy way to buy, install, and activate WPML
- Your clients get an exclusive 10% discount when buying WPML from within your theme or plugin
- You get up to 27% affiliate commission for every sale
Before we delve into how this is done, take a look at what your client will see once you have added the WPML Installer:
The installer is a public Composer library. To set it up, use the following steps:
- Get Composer
- Add the Installer as a dependency of your theme or plugin:
composer require otgs/installer
- Load the Installer bootstrap file and configure it accordingly, before the init hook:
require_once 'vendor/autoload.php'; include 'vendor/otgs/installer/loader.php'; WP_Installer_Setup($wp_installer_instance, array( 'plugins_install_tab' => 1, // optional, default value: 0 'affiliate_id:wpml' => '99999', // optional, default value: empty 'affiliate_key:wpml' => 'NNNNNNNNNN', // optional, default value: empty 'src_name' => 'NAME OF THEME', // optional, default value: empty, needed for coupons 'src_author' => '',// optional, default value: empty, needed for coupons 'repositories_include' => array('wpml') // optional, default to empty (show all) ) );
You can see the WPML Installer by navigating to Plugins -> Add New, under the Commercial tab.
In this example, we add a new tab to the theme options admin screen. The code below is specific to our example theme and shows how to register multiple tabs. You can use this code for inspiration, but note that your theme will use different code. Thus, you cannot copy/paste it “as is.”
You can easily find online tutorials on adding tabs to theme options for WordPress.
Custom admin installer:
echo '<div class="wrap otgsi_downloads_form">'; $config['template'] = 'compact'; //required $config['product_name'] = 'WPML'; $config['box_title'] = 'Multilingual GoodDay'; $config['name'] = 'GoodDay'; //name of theme/plugin $config['box_description'] = 'GoodDay theme is fully compatible with WPML - the WordPress Multilingual plugin. WPML lets you add languages to your existing sites and includes advanced translation management.'; $config['repository'] = 'wpml'; // required $config['package'] = 'wpml'; // required $config['product'] = 'multilingual-cms-2'; // required WP_Installer_Show_Products($config); echo "</div>";
Your clients can now install and activate WPML from within your theme, making it very easy for them to create multilingual sites using WPML.
WPML Installer works with our affiliate program, which offers you a commission from every sale you make. You can include your affiliate information in Installer. WPML sales that start from within your theme are counted toward your affiliate account.
To enjoy affiliate commission, you need to set your affiliate ID and affiliate key. You can get these by going to your WPML account and clicking the Affiliate link and payment link.
Use this form if you need help in adding the WPML Installer to your theme or plugin.