first of all I'm really sorry if the title of the question doesn't explain everything. Anyways here's what I was looking for.
I'm creating a WordPress plugin with OOP concept. So, I've codes like this
class somePlugin {
//constructor goes here
public function is_it_safe() {
if( true ) {
return true;
} else {
return false;
}
}
}
Please Note: the above code is just an example. So, it may not make any sense.
So, now what I want is to make sure the is_it_safe()
function can easily be called within other themes or plugins without even knowing the class or creating an object of the class. Is it possible?
I want the is_it_safe()
function to be used by others easily without even doing somePlugin::is_it_safe()
.
I'm not sure if it is possible or not. But if it is possible, if anyone can help, it would be heally helpful.
myplugin_is_it_safe()
which callssomePlugin::is_it_safe()
. Then include that file to your main plugin file. Now when you activate your plugin,myplugin_is_it_safe()
function should be available so asis_it_safe()
method. I hope you know what I mean. And again, I didn't test it so I don't know if it does work