Using TMG Activation Plugin to Recommends Plugins with Theme

Posted in Tutorials

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

In this tutorial, we are going to use the TMG Activation Plugin to recommend particular plugins in the theme notification such as this …

theme plugin recommendation

Here we want our theme to recommend the “Contact Form 7” plugin from our twentyfifteen-child theme we created in last tutorial.

First we download the TMG Activation Plugin after picking a few settings from their download page and clicking generate…

tmg plugin generate

After unzipping the downloaded zip, copy the class-tgm-plugin-activation.php file to the child theme directory.

Then copy the contents of example.php to the theme’s functions.php file and then amend the code for your particular case.  Because our is an simple example, our code ended up like this…

tmg code

Note that we have to amend the path to the class-tgm-plugin-activation.php file.  Recommending a plugin from the WordPress.org directory is one of the easier options.  The slug for the plugin is the sub-directory path in the URL to the plugin in the directory.

This plugins has a lot of other options include one to let you package your plugin along with your theme.