class sample{
public function __construct(){
add_action('init', array($this, 'samp') );
}
public function samp(){ // must be public!!
echo 'i did something';
}
}
new sample();
class sample{
public static function add_action_func(){
//note __CLASS__ will also include any namespacing
add_action('init', array(__CLASS__, 'samp') );
}
public static function samp(){
echo 'i did something';
}
}
sample::add_a...