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

13 responses to “TGM Plugin Activation Team Releases Custom Generator”

  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.

    • 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

    • 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.

    • 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.

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.