Skip to content

Instantly share code, notes, and snippets.

@mustardBees
Created August 27, 2013 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mustardBees/6356578 to your computer and use it in GitHub Desktop.
Save mustardBees/6356578 to your computer and use it in GitHub Desktop.
Metabox to save store information
<?php
/**
* Metabox to save store information
*
* @author Phil Wylie
* @link http://goo.gl/zJwIk5
*/
function pw_register_store_metabox( $meta_boxes ) {
$prefix = '_cmb_'; // Prefix for all fields
$meta_boxes[] = array(
'id' => 'store_meta_box',
'title' => 'Store Information',
'pages' => array( 'store' ), // post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Phone',
'id' => $prefix . 'phone',
'type' => 'text_medium',
),
array(
'name' => 'Location',
'desc' => 'Drag the marker to set the exact location',
'id' => $prefix . 'location',
'type' => 'pw_map',
),
),
);
return $meta_boxes;
}
add_filter( 'cmb_meta_boxes', 'pw_register_store_metabox' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment