metadata = maybe_unserialize(get_post_meta($post->ID, 'attire_post_meta', true)); } $this->Actions(); } function Actions() { add_action('admin_init', array($this, 'LoadMetaBoxes'), 0); add_action('save_post', array($this, 'SavePostMeta'), 10, 2); } function LoadMetaBoxes() { $this->meta_boxes = array( 'attire-page-width' => array( 'title' => __('Page Width', 'attire'), 'callback' => array($this, 'PageWidth'), 'position' => 'side', 'priority' => 'core', 'post_type' => get_post_types() ), 'attire-page-sidebar' => array( 'title' => __('Sidebar Layout', 'attire'), 'callback' => array($this, 'SidebarLayout'), 'position' => 'side', 'priority' => 'core', 'post_type' => get_post_types() ), 'attire-page-header' => array( 'title' => __('Header & Footer', 'attire'), 'callback' => array($this, 'headerFooter'), 'position' => 'side', 'priority' => 'core', 'post_type' => get_post_types() ), ); $this->meta_boxes = apply_filters("attire_metabox", $this->meta_boxes); foreach ($this->meta_boxes as $ID => $meta_box) { extract($meta_box); add_meta_box($ID, $title, $callback, $post_type, $position, $priority); } } /** * @usage Page Width * * @param $post */ function PageWidth($post) { if (!is_array($this->metadata)) { $this->metadata = maybe_unserialize(get_post_meta($post->ID, 'attire_post_meta', true)); } $container_fluid = ""; $container = ""; $val = get_post_meta($post->ID, 'attire_post_meta', true); if (isset($val['layout_page'])) { $val = $val['layout_page']; $default = $val === "default" ? "selected" : ""; $container_fluid = $val === "container-fluid" ? "selected" : ""; $container = $val === "container" ? "selected" : ""; } elseif ($container_fluid === "" && $container === "") { $default = "selected"; } wp_nonce_field('attire_page_layout_nonce', 'attire_page_layout_nonce'); echo "