[wp-hackers] how to integrate plugins into theme easily

Eric Marden wp at xentek.net
Sat Jun 6 07:46:58 GMT 2009

> A number of themes include code for special widgets and other custom  
> functionality in their functions.php file.
> On Jun 5, 2009, at 8:00 AM, Mayur Somani wrote:
>> How can I integrate any plugin into the theme itself so that I  
>> don't have to
>> ask the end user to install it.
>> Thanks.

functions.php is your only answer for automatic code being run with  
out user interaction. If you want to support other plugins, put the  
code in your theme with a check of function_exists() and then tell  
users that the theme has more functionality if they stall x-y-z plugins.

Look for the do_action and apply_filter hooks, and target them in  
functions.php or even write more generic plugins to be used by other  
users of the theme (if you are targeting someone else's theme). I did  
this with K2: http://xentek.net/code/wordpress/plugins/k2-hook-up/

And if this is your own theme, just build it into the theme directly.  
On K2 we have a pluggable.php file that has a number of functions that  
you can over ride (in functions.php or as a traditional plugin) to  
further tweak the theme, though this for more advanced users for sure.

- Eric Marden

More information about the wp-hackers mailing list