http://wpshout.com. Courtesy of the Hybrid theme - themehybrid.com * Adds the Hybrid Settings meta box on the Write Post/Page screeens * * @package Hybrid * @subpackage Admin */ /* Add a new meta box to the admin menu. */ add_action( 'admin_menu', 'hybrid_create_meta_box' ); /* Saves the meta box data. */ add_action( 'save_post', 'hybrid_save_meta_data' ); /** * Function for adding meta boxes to the admin. * Separate the post and page meta boxes. * * @since 0.3 */ function hybrid_create_meta_box() { global $theme_name; add_meta_box( 'post-meta-boxes', __('Post options'), 'post_meta_boxes', 'post', 'normal', 'high' ); add_meta_box( 'page-meta-boxes', __('Post options'), 'page_meta_boxes', 'page', 'normal', 'high' ); } /** * Array of variables for post meta boxes. Make the * function filterable to add options through child themes. * * @since 0.3 * @return array $meta_boxes */ function hybrid_post_meta_boxes() { /* Array of the meta box options. */ $meta_boxes = array( 'title' => array( 'name' => 'Title', 'title' => __('Title', 'hybrid'), 'type' => 'text' ), 'description' => array( 'name' => 'Description', 'title' => __('Description', 'hybrid'), 'type' => 'textarea' ), 'image' => array( 'name' => 'Image', 'title' => __('Image:', 'hybrid'), 'type' => 'text' ), 'featured' => array( 'name' => 'Featured', 'title' => __('Featured img:', 'hybrid'), 'type' => 'text' ), ); return apply_filters( 'hybrid_post_meta_boxes', $meta_boxes ); } /** * Array of variables for page meta boxes. Make the * function filterable to add options through child themes. * * @since 0.3 * @return array $meta_boxes */ function hybrid_page_meta_boxes() { /* Array of the meta box options. */ $meta_boxes = array( 'title' => array( 'name' => 'Title', 'title' => __('Title', 'hybrid'), 'type' => 'text' ), 'description' => array( 'name' => 'Description', 'title' => __('Description', 'hybrid'), 'type' => 'textarea' ), ); return apply_filters( 'hybrid_page_meta_boxes', $meta_boxes ); } /** * Displays meta boxes on the Write Post panel. Loops * through each meta box in the $meta_boxes variable. * Gets array from hybrid_post_meta_boxes(). * * @since 0.3 */ function post_meta_boxes() { global $post; $meta_boxes = hybrid_post_meta_boxes(); ?>