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.

I'm creating a wordpress theme that I aim to sell at some point.

Now, I've discovered that some of the wordpress.org plugins would be great for things that I want to do. They already hold much of the functionality I aim to achieve, so I thought of using them directly (they are under GPL I suppose).

I would probably need to adjust stuff, but I was wondering. Is there any universal-like way to include wordpress plugins inside my theme and not in the separate plugins folder ?

That would be ideal, because I do not really want customers to have to copy to different folders. At first glance of the plugins, it seems not possible, but I suppose it never hurts to ask :)

share|improve this question

3 Answers 3

up vote 8 down vote accepted

Let me make a recommendation: do not bundle plugins with your theme!

On first glance, yes this is a very easy way to add default functionality with your theme, but there are a slew of reasons not to include the plugins this way:

  1. Updates: If the plugin is freely available from WordPress.org already, then so are automatic updates to the plugin. The original author can add features, fix bugs, and deploy them quickly. Your clients and customers then benefit from on-going development. If you were to package them in your theme, though, you are essentially freezing the code at that point in time - any further updates, bug fixes, etc. would have to come from you. This means you'll need to continuously release theme updates whenever the included plugins update.
  2. Updates: When WordPress updates, some plugins will break. This is because the original authors didn't take the time to remove deprecated functionality or test with new versions of WP. Do you really want to commit to maintaining your theme + someone else's code?
  3. Interoperability: As the great mfields once said, "If you're building a bathroom and you change the wallpaper, the toilet shouldn't disappear, too." Users should be able to swap out themes whenever they want without losing their content, their custom data, or the additional functionality they have on their site. Remember, themes are meant for presentation, plugins are meant for functionality.

There have been plenty of other people who've talked about this in the past.

The better way to do this would be to have your theme check for specific plugins and prompt the user for installation if they're missing.

share|improve this answer
2  
And if you search hard enough, you can even find example code for Themes auto-installing Plugins from the Repository, which is a better alternative to bundling the Plugin code directly. –  Chip Bennett Jul 6 '11 at 20:45
    
I actually abandoned the idea of including the plugins directly in my theme, because of the updates problem. However, as i have it now, i just let the plugins live on the plugins folder of wordpress and load them automatically. As long as they don't break in the future things will be fine. I will also make sure to provide the buyers with the versions that do work. These 3-4 plugins are very useful to me and save me too much time to abandon the idea. I would need employees to do these things for me instead :) The plugins that i use are tied up to the functionality of my theme, so i think is ok. –  SpyrosP Jul 7 '11 at 3:10

This class was built with your question and idea in mind. It solves that problem by allowing theme authors to include pre-packaged plugins or plugins from the repo with ease.

https://github.com/thomasgriffin/TGM-Plugin-Activation

share|improve this answer
    
Can't thank you enough! –  Sinthia V Feb 11 '12 at 2:07
    
Interesting! Do you have any example of an open source Theme that uses it? Thanks! –  julien_c Mar 21 '12 at 16:59
    
By "open source" do you mean free? There are quite a few plugins in the WordPress repository, and I believe it has been adopted by a few theme authors from ThemeForest. I can't exactly track stats of where it is, but I know there has been plenty of use with it. Here is one example of a plugin that is using it: wordpress.org/extend/plugins/google-analytics-top-posts-widget –  Thomas Mar 31 '12 at 3:19

I strongly believe that if you aim to sell at some point you should NOT include/use GPL plugins and only your own!!!

Now after that being said simply include the plugin's main file you your theme's functions.php and edit all path's

share|improve this answer
    
hmm, why do you say that i should not include plugins from wordpress repository ? I'm interested in your opinion. Is it because of probable law reasons ? –  SpyrosP Jul 6 '11 at 7:43
    
YEP That would be one, but the main reason. –  Bainternet Jul 6 '11 at 7:45
    
It seems that lots of theme designers use already made wordpress plugins in themes that they sell, without any problems. Moreover, they are all published under GPL, so i don't really see how it can cause me problems. Am i missing something ? –  SpyrosP Jul 6 '11 at 7:57
    
What do you think GPL means? –  Bainternet Jul 6 '11 at 8:44
4  
@Bainternet: "as long as it stays free" applies to freedom of use, not to cost. In fact, the GPL explicitly allows selling and/or re-selling of GPL-licensed code. –  Chip Bennett Jul 6 '11 at 20:42

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.