Skip to content

Instantly share code, notes, and snippets.

@GaryJones
Forked from billerickson/gist:1547637
Created January 1, 2012 16:48
Show Gist options
  • Save GaryJones/1547753 to your computer and use it in GitHub Desktop.
Save GaryJones/1547753 to your computer and use it in GitHub Desktop.
Create session metaboxes
<?php
add_action( 'init', 'be_initialize_meta_boxes' );
/**
* Initialize the metabox code library.
*
* Since this code might be in the theme and multiple plugins,
* see if it exists already before initializing it.
*
*/
function initialize_meta_boxes() {
if ( ! class_exists( 'cmb_Meta_Box' ) )
require_once( 'lib/metabox/init.php' );
}
add_filter( 'cmb_meta_boxes', 'be_session_metabox' );
/**
* Define metabox configuration.
*/
function be_session_metabox() {
return array(
'id' => 'session-details',
'title' => 'Session Details',
'pages' => array( 'sessions', ),
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
'fields' => array(
array(
'name' => 'Date',
'id' => 'be_session_date',
'desc' => '',
'type' => 'text_date_timestamp',
),
array(
'name' => 'Time',
'id' => 'be_session_time',
'desc' => '',
'type' => 'text_time',
),
array(
'name' => 'Location',
'id' => 'be_session_location',
'desc' => '',
'type' => 'wysiwyg',
'options' => array(
'textarea_rows' => 5,
'media_buttons' => false,
),
),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment