function __construct() { parent::__construct(array('post_type' => 'hotel', 'module_file' => __FILE__)); $this->get_data(); }
public $metabox; function __construct($arg = array()) { parent::__construct($arg); } static function init() { add_action('after_setup_theme', array(__CLASS__, '_check_create_table_price')); } static function _check_create_table_price() { global $wpdb; $table_name = $wpdb->prefix . 'st_price'; if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) { //table is not created. you may create the table here. global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $sql = "CREATE TABLE {$table_name} (\r\n id mediumint(9) NOT NULL AUTO_INCREMENT,\r\n post_id int NOT NULL,\r\n price_type varchar(255),\r\n price decimal NOT NULL,\r\n start_date date NOT NULL,\r\n end_date date NOT NULL,\r\n status int NOT NULL,\r\n priority int NOT NULL,\r\n UNIQUE KEY id (id)\r\n ) {$charset_collate};"; $wpdb->query($sql); if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) { return false; } else { return true; } } else { return true; } } } ST_Abstract_Admin_Controller::init(); }
function __construct() { parent::__construct(array('post_type' => 'product', 'module_file' => __FILE__)); add_action('init', array($this, '_add_metabox')); }