Skip to content

Instantly share code, notes, and snippets.

@mikeschinkel
Created January 18, 2012 03:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeschinkel/1630788 to your computer and use it in GitHub Desktop.
Save mikeschinkel/1630788 to your computer and use it in GitHub Desktop.
Example showing how to use proposed add_autohook_support() for WordPress.
<?php
/**
* Example for use of proposed add_autohook_support() for WordPress.
*
* @see: https://gist.github.com/1630212
*
* Author: Mike Schinkel
* Author URI: http://about.me/mikeschinkel/
*/
class AutoHook_Example {
static function on_load() {
add_autohook_support( __CLASS__, array(
'manage_edit_panel_set_columns' => 'manage_edit-panel_set_columns', // Set hook name
'manage_edit_comic_columns' => array( 'manage_edit-comic_columns', 99 ), // Set hook name and priority to 99
'save_post' => 25, // Set priority to 25
'init' => false, // Don't use as hook
));
}
static function manage_edit_panel_set_columns( ... ) {
...
}
static function manage_edit_comic_columns( ... ) {
...
}
static function save_post( ... ) {
...
}
static function init( ... ) {
...
}
}
AutoHook_Example::on_load()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment