Created
August 27, 2013 17:36
-
-
Save mustardBees/6356578 to your computer and use it in GitHub Desktop.
Metabox to save store information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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