public
Last active

Example showing how to use proposed add_autohook_support() for WordPress.

  • Download Gist
autohook-example.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
<?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()

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.