1

I have a couple of pluins which I use every time I create a new WP-page. Is there a way to implement these plugins as part of my theme? I have searched for a soloution for a couple of hours now, without any luck - hope someone can help :)

2 Answers 2

3

First, I would recommend against it.

I have a package of plugins that I use on almost all of our websites (both public and internal plugins)... and plugins should really remain plugins. Deploying a package of plugins is not hard or time consuming and only needs to be done once per project.

By integrating them into a theme, you lose the ability to activate/deactivate them if necessary, nor can you update them. Please consider that first.

Ok, so to incorporate them into your theme, this is what you would do...

  1. Create a "plugins" folder within your theme.
  2. Place both plugins in that folder.
  3. Within your functions.php file, use require_once to load each of the plugins default php files (if the plugin authors correctly followed convention, the main plugin file will be the one that matches the plugin folder name).
  4. Done.

Please also take note that you may have problems with activation/deactivation functions... so be careful.

0

You can have a look at https://github.com/thomasgriffin/TGM-Plugin-Activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes

And this: How to make plugin required in a wp theme without using php conditional statements when calling an individual function from that plugin?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.