[wp-hackers] Accessing a plugins function from theme

Andrew Nacin wp at andrewnacin.com
Wed Jul 21 09:02:07 UTC 2010


On Jul 21, 2010, at 4:48 AM, Christian Gundersson wrote:

> Is there any way that I can access a function in a plugin from a theme?
>

On Wed, Jul 21, 2010 at 4:56 AM, Mike Schinkel <mikeschinkel at newclarity.net>
 wrote:

> Yes, any functions in your plugin go into PHP's global name space and will
> be accessible from your theme.
>

You may also wish to wrap that function in a function_exists() call to
ensure that the theme doesn't error out if the plugin is deactivated.

You may also be interested in this blog post on rethinking how functions
defined in plugins could be used in themes:
http://www.andrewnacin.com/2010/05/18/rethinking-template-tags-in-plugins/


More information about the wp-hackers mailing list