[wp-hackers] Accessing a plugins function from theme

Mike Schinkel mikeschinkel at newclarity.net
Wed Jul 21 08:56:16 UTC 2010


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

-Mike

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

> Hi all!
> 
> 
> 
> Is there any way that I can access a function in a plugin from a theme? Say,
> for example, my plugin has a function foo() that I want to access from the
> theme. I assumed that the functions would be available to theme files when
> they load.
> 
> 
> 
> I thought about using a filter and a meta tag (like [my_plugin_foo] and
> parsing all posts for a replace) or putting foo() in my functions.php file,
> but I'm kind of anal and would like to keep the plugin code in the plugin.
> 
> 
> 
> I haven't found anything regarding this on the codex or on google so any
> pointers to a resource would be appreciated.
> 
> 
> 
> Thanks! (Oh, and if this is absolutely stupid, feel free to say so J)
> 
> 
> 
> //Christian
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list