コード例 #1
0
 /**
  * Initialize the plugin by setting localization, filters, and administration functions.
  *
  * @since 0.0.1
  *
  * @access private
  */
 private function __construct()
 {
     // Load plugin text domain
     add_action('init', array($this, 'load_plugin_textdomain'));
     // Load admin style sheet and JavaScript.
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_stylescripts'));
     // init modules
     self::get_modules();
     // init metaboxes
     if (class_exists('Lsx_Metabox')) {
         Lsx_Metabox::get_instance();
     }
 }
コード例 #2
0
/**
 * Register a metabox with LST
 *
 * @since 0.0.1
 *
 */
function lsx_register_metabox($metabox)
{
    $metabox = (array) $metabox;
    if (empty($metabox['name'])) {
        trigger_error(sprintf(__('A name is required for your metabox.', 'lsx')));
    }
    if (empty($metabox['post_type'])) {
        trigger_error(sprintf(__('A post_type is required for your metabox.', 'lsx')));
    }
    $defaults = array('post_type' => '', 'name' => '', 'section' => '', 'section_priority' => 10, 'panel' => __('General', 'lsx'), 'panel_priority' => 10, 'context' => 'advanced', 'priority' => 'default', 'fields' => array());
    $metaboxes = Lsx_Metabox::get_instance();
    $metaboxes->register_metabox(array_merge($defaults, $metabox));
}
コード例 #3
0
 /**
  * Return an instance of this class.
  *
  * @since 0.0.1
  *
  * @return    object|Lsx    A single instance of this class.
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }