lundi 29 février 2016

Calling a Wordpress function out of class

I have a woocommerce plugin that has a class Foo:

class WC_Foo extends WC_Shipping_Method{
    function sayHello(){
        echo "Hello";
    }
}

I want to call sayHello() out of the Foo class:

function bar(){
    WC_Foo->sayHello();
}

But I get this error:

Fatal error: Call to a member function `sayHello` on a non-object.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire