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