[wp-hackers] Accessing a plugins function from theme

Christian Gundersson christian at buro2.se
Wed Jul 21 09:30:06 UTC 2010


The plugin is activated and working for all other intents and purposes, and
it's not wrapped in a class either.

As a side thought, if the function would produce a fatal error in itself
when the plugin file is parsed, would that keep the definition from being
read, or would it be still be "callable" and then generate an error?

//Christian

-----Ursprungligt meddelande-----
Från: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] För Mike Schinkel
Skickat: den 21 juli 2010 11:24
Till: wp-hackers at lists.automattic.com
Ämne: Re: [wp-hackers] Accessing a plugins function from theme

Obvious question, but; I assume you've activated the plugin?
If yes, your function isn't wrapped in a class, is it?

-Mike

On Jul 21, 2010, at 5:21 AM, Christian Gundersson wrote:

> Hi,
> 
> Thanks for the replies. I see now that I probably should have clarified a
> bit more :)
> 
> I have done this but my function isn't getting called like it should. I
get
> a "call to undefined function" error when I access the theme file.
> 
> I have declared a function foo() in my plugins base file. I haven't
attached
> it to any filters or hooks of any kind. In my theme file I call the
function
> simply by 
> 
> if ( function_exists ( 'foo' ) )
> foo();
> 
> Have I missed anything, or should that "just work"?
> 
> Thanks again!
> 
> //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