1
votes

I'm building a Wordpress theme, and I would like it to work without having to separately download the plugins it uses (e.g. internalization, contact form and lightbox).

Is it possible to place plugin files inside a Wordpress theme (or is there another way of solving this)?

e.g: wp-content/themes/my-wordpress-theme/plugins

3

3 Answers

3
votes

When a theme comes packaged with its own plugins, the end user is instructed to install it in /wpcontent as opposed to the normal /wp-content/themes directory so that plugins and theme files are installed in their appropriate places. You want that separation between form and function.

The theme should include hooks to those plugins, and then the administrator has to activate them after installation.

Packaging your theme like this is effectively what you are trying to do; we are just broadening the definition of a theme a bit to include its plugin directory.

If you are determined to have the plugin directory be a subdirectory of the theme, I'm not sure if or how that's doable, but it is bad practice because it doesn't maintain the separation between form and function.

1
votes

If the plugin is large, you have to put it into a separate plugin. Otherwise people will be very angry with you :)

If your 'plugin' consists of a few PHP functions you can put them in functions.php.

But, it's better to put it in a separate plugin. With an added bonus: Put your plugin on http://wordpress.org/extend/plugins/ and other people can use and extend your work.

0
votes

If you want to put all the plugins bundled into your theme. Then what would you achieve? You will freeze the time. The plugin developers continuously update them. And the functionalities of all these functions are not needed in every wordpress implementation. When users use the plugins right from codex, they can update them anytime they want.

Also, your choice of collection of plugins and their functionalities most likely wont match evryone else's. So, its better to keep them as they are. Rather it better idea to develop your own things while not always re-inventing the wheel when your wheel is not better than existing ones.