Quantcast
Channel: Topic Tag: plugin | WordPress.org
Viewing all articles
Browse latest Browse all 26892

edtiley on "Undefined Function Fatal Error In Plugin Class"

$
0
0

Building a plugin using Class structure.

Want to display the result of a formula, so I created a public function so it could be done as needed. Something like:

public function foo($x,$y) {
   return strval(($x+$y)*2.2) ;
  }

I keep getting an undefined function. Finally I put the function in functions.php and it works like a champ. So it's obvious the function isn't getting loaded.

I've tried using init and plugins_loaded in add_action calls, but the function is still not available.

Surely there's a fairly simple way of making the function available inside the plugin without having to hook it. Isn't there?

TIA
Ed


Viewing all articles
Browse latest Browse all 26892

Trending Articles