PHP error with shortcode handler from a class
As the error says you need an instance of the class to use $this. There are at least three possibilities: Make everything static class My_Plugin { private static $var=”foo”; static function foo() { return self::$var; // never echo or print in a shortcode! } } add_shortcode( ‘baztag’, array( ‘My_Plugin’, ‘foo’ ) ); But that’s not … Read more