TGM Plugin Activation Team Releases Custom Generator

The development team behind TGM Plugin Activation released its new generator last week. The popular tool is a PHP library that allows WordPress developers to require or recommend plugins for a theme or plugin. It essentially helps walk WordPress users through installation and activation of plugin dependencies in the admin.

Bundling a bunch of plugin-type functionality into a theme is generally discouraged, but authors still need a way to recommend additional extensions. The TGMPA library is a solution to this problem and is recommended by Themeforest, CodeCanyon, and the WordPress.org Theme Review Team as an alternative to bundling.

The new generator addresses an issue that theme authors were running up against while using TGMPA and publishing themes to WordPress.org. The Theme Check plugin would often spit out feedback preventing the theme from passing all the checks: “You are only allowed to use add_theme_page(), please remove the call to add_submenu_page(),” or “You are only supposed to use one text-domain.”

According to TGMPA contributor Juliette Reinders Folmer’s, authors reported having performed a search-and-replace that resulted in fatal errors because it would often change some strings that should not have been changed. This process repeated anytime TGMPA needed to be updated.

The Custom TGMPA generator asks the author to input the type of extension where TGMPA is being used, as well as the avenue of distribution. Authors then add the text domain, function prefix, and the theme/plugin name. The generator automatically outputs a download of the latest stable version of TGMPA with the customized strings already in place.

tgmpa-custom-generator

The Custom TGMPA generator is the result of a discussion with WordPress.org representatives regarding issues that continually pop up during theme reviews. The generator provided an acceptable solution that doesn’t require bypassing the Theme Check Plugin. Authors who experience any bugs with the generator can log them with the TGMPA team in the project’s GitHub issues queue. The team is still trucking on the 3.0 milestone which aims to make TGMPA updatable independent of the plugin/theme that ships it.

13 Comments


  1. Fantastic idea! I had to comment out a line of code and replace the text-domain in one of my themes on WP.org where I use the TGMPA library, but this didn’t present much of a problem. However, this solution is way better and will make the process of adding TGMPA much smoother and quicker.

    Report


    1. Glad you like it! It definitely should make upgrading a lot easier ;-)

      Report


  2. Great news. We regularly recommend TGM to theme authors that want to include Beaver Builder with their themes.

    It’s a great solution to the bundling problem that causes issues like the infamous Slider Revolution vulnerability.

    Report


  3. This is a good news for developers. The library is very useful. We always recommend it to users of Meta Box if they want to include the plugin in themes or plugins.

    Just wonder is there any difference between the generated results for parent theme, child theme or plugin?

    Report


    1. Hi Anh Tran, very good question. The answer is yes.
      The Custom TGMPA Generator can create 7 different versions depending on the settings the user chooses.

      Some examples:
      * For themes to be published on wp.org, the text domain will be adjusted. For plugins it will not be.
      * The include path in the example file will be adjusted based on whether TGMPA will be included in a parent theme, child theme or plugin.

      For details of all the differences – have a look at the table in the pull request
      https://github.com/TGMPA/TGM-Plugin-Activation/pull/519

      Report


  4. A great tool! Until now I’ve had to do this manually, so this is a perfect helper. Still, can’t wait for 3.0 release.

    What a tool to recommend a Beaver Builder ;)

    Report


    1. Oliver, I was curious if this was something that affected you. Glad to hear it’s making life easier. We’re really big fans of this method of “bundling” themes/plugins.

      We should have a chat here soon. We’re working on a really cool feature for theme developers to bundle pre-made Beaver Builder templates with their themes! This would be in the free version of Beaver Builder that currently doesn’t have template support.

      Report


      1. Wow, Robby, that’s a good news! And thank you guys for implementing this into a BB Lite! A great start for new users, indeed.

        If you need help with testing, just let me know.

        Report


  5. In my theme, I had switched the version in the bower config to pull from Samuel Wood’s fork of TGMPA, which passes the theme check. I’d still prefer to be able to pull in the class externally, since I don’t like committing code that’s not mine in the theme repo (that’s what bower is for). I may keep using the fork until version 3 drops, I haven’t decided yet.

    Report


    1. Hi Paul, just FYI – we’ll probably release a 2.6 version before 3.0 and I’m not sure Samuel will update his fork for that.
      The Custom TGMPA Generator will stay up to date with the latest version we release and will be updated for any new code we introduce which we believe could conflict with Theme Check. Additionally it does some more detailed adjustments based on the intented use of TGMPA to make integration as easy as possible.

      Report


      1. If people are using it, and you give me enough notification, than I’m quite happy to keep the fork up to date, even though it was a one off.

        Report

Comments are closed.