register_helper() static public method

Register a helper class to the specified class.
static public register_helper ( string $helper_class, string | boolean $helped_class = false )
$helper_class string The name of the helper class.
$helped_class string | boolean Name of the class adding the helper. Defaults to called class.
Exemplo n.º 1
0
 /**
  *
  */
 static function on_load()
 {
     /**
      * Add this class as a helper to WPLib
      */
     WPLib::register_helper(__CLASS__);
 }
Exemplo n.º 2
0
 /**
  * Run on WordPress's 'init' hook to register all the post types defined in classes that extend this class.
  */
 static function on_load()
 {
     /**
      * Add this class as a helper to WPLib
      */
     WPLib::register_helper(__CLASS__);
     /*
      * Process these templates once for language translation.
      * Use this base class' name used to find the templates.
      */
     self::$_default_labels = array('add_new_item' => _x('Add New %s', 'posts', 'wplib'), 'new_item' => _x('New %s', 'posts', 'wplib'), 'edit_item' => _x('Edit %s', 'posts', 'wplib'), 'view_item' => _x('View %s', 'posts', 'wplib'), 'all_items' => _x('All %s', 'posts', 'wplib'), 'search_items' => _x('Search %s', 'posts', 'wplib'), 'parent_item_colon' => _x('Parent %s:', 'posts', 'wplib'), 'not_found' => _x('No %s found.', 'posts', 'wplib'), 'not_found_in_trash' => _x('No %s found in Trash.', 'posts', 'wplib'));
     self::add_class_action('init');
     self::add_class_action('init', 99);
     self::add_class_action('wp_loaded');
 }