Skip to content

Instantly share code, notes, and snippets.

@media317
Created December 16, 2013 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save media317/7994820 to your computer and use it in GitHub Desktop.
Save media317/7994820 to your computer and use it in GitHub Desktop.
Multiple Meta Boxes
<?php
/**
* Metaboxes
*
* This file registers any custom metaboxes
*
* @package Core_Functionality
* @since 1.0.0
* @link https://github.com/billerickson/Core-Functionality
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*/
/**
* Create Metaboxes
* @since 1.0.0
* @link http://www.billerickson.net/wordpress-metaboxes/
*/
function be_metaboxes( $meta_boxes ) {
$meta_boxes[] = array(
'id' => 'staff-information',
'title' => 'Staff',
'pages' => array('staff'),
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
'fields' => array(
array(
'name' => 'ID Code',
'desc' => 'ID Code for this person from Causeview',
'id' => 'mmi_idcode',
'type' => 'text'
),
'id' => 'project-details',
'title' => 'Project Details',
'pages' => array('projects'),
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
'fields' => array(
array(
'name' => 'GL Code',
'desc' => 'GL Code for this Project',
'id' => 'mmi_glcode',
'type' => 'text'
),
),
);
return $meta_boxes;
}
add_filter( 'cmb_meta_boxes' , 'be_metaboxes' );
/**
* Initialize Metabox Class
* @since 1.0.0
* see /lib/metabox/example-functions.php for more information
*
*/
function be_initialize_cmb_meta_boxes() {
if ( !class_exists( 'cmb_Meta_Box' ) ) {
require_once( BE_DIR . '/lib/metabox/init.php' );
}
}
add_action( 'init', 'be_initialize_cmb_meta_boxes', 9999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment