Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My Theme defines its own actions and filters so that it can be extended by third-parties without having to fork or modify the Theme's core code.

I already have a few plugins specific to my Theme, that I'm installing in the usual way in wp-content/plugins and activating through the Admin panel.

However, for ease of use, I would like to bundle a few plugins directly into my Theme itself, for example in my_theme/plugins, without having to require the user to move the plugins he wants to install to the WordPress plugin directory (thus breaking the Theme's update capabilities, etc.).

Have you seen any Theme or Plugin that does that in an elegant way? What are best practices to doing that?

In particular, a few questions come to mind if I were to implement such a system:

  • Is there a way to easily configure a custom plugin directory into WordPress, in addition to wp-content/plugins?
  • If I were to simply implement my own naive plugin activation system, what steps should I take? Do I just need to set up a basic admin panel listing, store a list of activated "custom plugins" and just include the corresponding PHP files on Theme init?

Thanks for your help!

EDIT: Related to, but different from, Are drop-in plugins a product of design and Add Plugins to Wordpress Theme: in the present case, plugins don't make sense without the Theme (they extend it) and they're written by the same person/company.

share|improve this question

3 Answers 3

Ok, I've actually found (in yet another question) that the Carrington Theme includes bundled plugins. I'm still unsure however if this is done in the best possible way: http://wordpress.stackexchange.com/a/27533/4826

share|improve this answer

See Add multiple plugin directories for one way to do this.

In an earlier project I did something similar, but I used a dedicated theme options page for my theme plugins.
Looking back … I wouldn’t do that again. Plugin updates are a too complicated, separated version control setups too. The client wasn’t always sure where to look at when we were talking about plugins.

And sooner or later you may want to re-use a plugin from theme 1 for theme 2 – you end up copying files back and forth … far from ideal.

You can bundle multiple (single file) plugins in one directory inside the regular plugin directory. In your theme you can use is_plugin_active() to check your requirements.

TL;DR: Keep plugins and theme separate. You don’t save any work by mixing both.

share|improve this answer
    
Great points. I had actually seen the (impressive) answer you linked to (probably in a weekly digest mail one or two weeks ago) but had deemed it as too complicated... But it might not be that bad after all. And if I understand correctly, it may end up in core, right? –  julien_c Mar 21 '12 at 18:15
    
@julien_c About the core … I wouldn’t wait for it. :) It may take a looong time. –  toscho Mar 21 '12 at 18:22
    
I won't be waiting for it, but it can help me decide between recoding the wheel or base my code on something that might one day be officially supported :) –  julien_c Mar 21 '12 at 18:30

There's another kid on the block in this regard that's an addon for themes. It allows you create dependencies in a theme and handles guiding people through installation of the plugins you define in a nice way. The plugins don't even have to be in the WP repo.

Check it out: http://tgmpluginactivation.com/

share|improve this answer
    
I had seen that and it looks great, but I'm not sure it suits my use case: in my case, I want to include plugins but not actually activate them, unless the user explicitly activates them. They're not actually *plugin requirements$. –  julien_c Mar 21 '12 at 18:37
    
@julien_c Looking at the documentation you can set whether a plugin is a requirement or a recommendation by passing in 'required' => true when you register it –  sanchothefat Mar 21 '12 at 23:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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