I have just developed a Wordpress plugin and it is all structured within a class called isimpledesign_feeds_class() so everything works fine and i am calling a function out from the class using.
<?php
$isimpledesign = new isimpledesign_feeds_class();
$isimpledesign->isimpledesign_feeds();
?>
开发者_Go百科
i was just wondering if their is a problem calling it like this because from previous plugins i have always used
<?php
if (function_exists('isimpledesign_feeds')) {
isimpledesign_feeds();
}
?>
to call a function in the theme files.
Just wondering if anyone has any suggestions?
Is this the correct way to call a function from a class in Wordpress?
Thanks
The first call is more object oriented the second seems to be a "old-school" version of the same plugin. If the first version works there is no problem!
Usually theme files of Wordpress do not have classes in it. So it was working.
But in your plugin you are using Class. So it is not possible to call any function of class without using object of that class or using classname.
精彩评论