If you must, do it this way.


Alex King explains how they handle including plugin functionality in their themes:

Since the theme is loading in last, we can use that to our advantage. If the plugin has been installed separately as a plugin (and not as part of the theme), we will be able to see that it is active. If it is already active, we don’t want to load it again a second time.

In our FavePersonal theme we added an additional check in the if statement to see if the setting to activate the Social plugin was turned on. This allows us to avoid loading the plugin if the site owner has decided to disable this functionality.

If you must include a plugin’s functionality in your theme, this is the way to do it.

5 thoughts on “If you must, do it this way.

  1. I disagree. By included a plugin in your theme you completely remove the ability to upgrade it.

    I’d much rather use something like the TGM Plugin Activation class to include necessary plugins. The class is pretty heavy and can be over kill, but I’d argue that it’s much better than included the plugin directly in the theme.

Comments are closed.