Let's say this was in my plugin:
class pluginslug_foo {
public function bar() {
//stuff
}
}
and I wanted to make the method bar available for use outside of the plugin, for instance in a theme file so it could be called with pluginslug_bar();
.
I tried:
function pluginslug_get_foo() {
$foo = new pluginslug_foo();
return $foo;
}
function pluginslug_bar() {
$bar = $foo->bar;
}
But I got an unknown variable error for $bar when I tried pluginslug_bar();
in my theme:(