TGM Plugin Activation (Simple way)

TGM Plugin Activation is a PHP library that allows user to easily require or recommend plugins for your WordPress themes (and plugins). It allows users to install, update and even automatically activate plugins in singular or bulk fashion. You can reference bundled plugins, plugins from the WordPress Plugin Repository or even plugins hosted elsewhere on the internet.
Here are the simplest method to make available of TGM Plugin(to recommend the plugin for your wordpress theme.)
1. Download the TGM zip file and extract it.
2. Extract the downloaded folder.
3. Copy the class-tgm-activation.php file from extracted folder to the theme where you want to set TGM plugin.
Before copying the acquire theme look like this,

After copying

4. Now, copy the plugins directory also inside the particular theme

5. At last of functions.php file (wp-content>themes>functions.php) copy the content of example.php (inside the extracted TGM Plugin File).

The content copied contains much of comments which you can refine by deleting the comment and deleting the unrequired plugins array and add in the exact format as shown in the example for each type in the example.php file.
Here, I am giving the example of plugins verified in

The format is:
    ‘name’ => ‘Name of Plugin’,
    ‘slug’ => ‘Last name of the plugin site in’,
    ‘required’ => ‘false’,

The example is also shown in the image below:

For other plugin than verified in you can use the method shown in example.php file in extracted folder.

I hope it gives a simple way to how to add recommend plugins in the theme.



You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *