/** * Construct function to get things started. */ public function __construct() { // Setup some base variables for the plugin $this->basename = art_store()->basename; $this->directory_path = art_store()->directory_path; $this->directory_url = art_store()->directory_url; }
/** * Public function for getting a product's meta * * @return array An array of post meta for the current post */ function get_art_store_info($post_id = 0, $field = '') { // return false if no post id was passed if (!$post_id) { return false; } $prefix = art_store()->prefix; $info['price'] = get_post_meta($post_id, $prefix . 'price', true) ? get_post_meta($post_id, $prefix . 'price', true) : ''; $info['status'] = get_post_meta($post_id, $prefix . 'status', true) ? get_post_meta($post_id, $prefix . 'status', true) : 'sale'; $info['btn_url'] = get_post_meta($post_id, $prefix . 'button_url', true) ? get_post_meta($post_id, $prefix . 'button_url', true) : ''; $info['btn_code'] = get_post_meta($post_id, $prefix . 'button_html', true) ? get_post_meta($post_id, $prefix . 'button_html', true) : ''; $info['shipping'] = get_post_meta($post_id, $prefix . 'shipping_info', true) ? get_post_meta($post_id, $prefix . 'shipping_info', true) : ''; $info['width'] = get_post_meta($post_id, $prefix . 'width', true) ? get_post_meta($post_id, $prefix . 'width', true) : ''; $info['height'] = get_post_meta($post_id, $prefix . 'height', true) ? get_post_meta($post_id, $prefix . 'height', true) : ''; $info['depth'] = get_post_meta($post_id, $prefix . 'depth', true) ? get_post_meta($post_id, $prefix . 'depth', true) : ''; $info['notes'] = get_post_meta($post_id, $prefix . 'other_notes', true) ? get_post_meta($post_id, $prefix . 'other_notes', true) : ''; // if no field was passed, return the full array if ('' == $field) { return $info; // otherwise, return the single field requested } else { // check that the field exists if (isset($info[$field])) { return $info[$field]; } else { return wp_die(sprintf(__('Incorrect parameter passed to %1$sget_art_store_info%2$s. Could not find a value for %3$s.', 'art-store'), '<code>', '</code>', $field), __('Art Store Error', 'art-store')); } } }
/** * Construct function to get things started. */ public function __construct() { // Setup some base variables for the plugin $this->basename = art_store()->basename; $this->directory_path = art_store()->directory_path; $this->directory_url = art_store()->directory_url; $this->title = __('Art Store Options', 'art-store'); }
/** * Construct function to get things started. */ public function __construct() { // Setup some base variables for the plugin $this->basename = art_store()->basename; $this->directory_path = art_store()->directory_path; $this->directory_url = art_store()->directory_url; $this->prefix = art_store()->prefix; /** * Handle the meta boxes */ add_filter('cmb2_meta_boxes', array($this, 'do_meta_boxes')); }