This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

TGM Plugin Activation

  • Creator
    Topic
  • #14234
    Andre Goersch
    Participant

    I was curious as to how does Jumpstart displayed notifications asking us to install other plugins, and I found out that it uses the TGM Plugin Activation library. I’m not very familiar with it, but it seems that it could be quite helpful.

    My main question is: if I want to use this with my child theme, with additional plugins being required/recommended, do I need to add the library from scratch, or is there a simple way to just reuse the one added for JumpStart itself? Could you post an example code of how to use it?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #14250
    Jason Bobich
    Keymaster

    Hello Andre,

    See the themeblvd_tgm_register() function in /framework/admin/plugins/plugins.php. You’ll see there’s an array of plugins that get passed into the TGM class, and of course we’ve put a filter on it. The filter is called “themeblvd_plugins” —

    You’re just modifying that array with the filter. Here’s an example of how you might add a plugin:

    function my_plugins( $plugins ) {
    	
    	$plugins[] = array(
    		'name'		=> 'Example Plugin',
    		'slug'		=> 'example', // This needs to match slug on wordpress.org
    		'required'	=> false
    	);
    
    	return $plugins;
    }
    add_filter( 'themeblvd_plugins', 'my_plugins' );
    #14273
    Andre Goersch
    Participant

    That works perfectly. Thanks.

    Another nice piece of information that would be great to have on the official docs. 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.