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 the following code.
<?php $isimpledesign = new isimpledesign_feeds_class(); $isimpledesign->isimpledesign_feeds(); ?>
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 second method doesn’t assume that your plugin is available for the theme to work. However, the first method assumes that the plugin is already there.
This means that the first method will fail if your plugin isn’t loaded for some reason and will probably break the template as well.