Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyClass {
- function __construct() {
- add_action( 'init',array( $this, 'getStuffDone' ) );
- }
- function getStuffDone() {
- // .. This is where stuff gets done ..
- }
- }
- $var = new MyClass();
- namespace NS{
- class MyClass {
- public function __construct() {
- add_action( 'init',array( $this, 'getStuffDone' ) );
- }
- public function getStuffDone() {
- // .. This is where stuff gets done ..
- }
- }
- }
- $var = new MyClass();
- add_action('init',function(){
- $lat = new NSClassopac();
- $lath->getStuffDone();
- });
- class MyClass {
- public function __construct() {
- }
- public function hooks() {
- add_action( 'admin_init', array( $this, 'doAdminTest' ) );
- add_action( 'init', array( $this, 'doGeneralTest' ) );
- }
- public function doAdminTest() {
- die( 'We are in the admin area.' );
- }
- public function doGeneralTest() {
- die( 'We are in the init hook.' );
- }
- }
- $var = new MyClass();
- add_action( 'plugins_loaded', array( $var, 'hooks' ) );
Add Comment
Please, Sign In to add comment