Skip to content

Instantly share code, notes, and snippets.

@tomjn
Created August 21, 2013 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomjn/ebcc00d0ef8b6964ec62 to your computer and use it in GitHub Desktop.
Save tomjn/ebcc00d0ef8b6964ec62 to your computer and use it in GitHub Desktop.
<?php
// Using static methods
class Work {
public function __construct() {
// do work
}
public static function new_instance() {
return new Work();
}
}
add_action( 'admin_init', array( 'Work', 'new_instance' ) );
// Using Closures
add_action( 'admin_init', function() {
// do work
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment