Last active
August 29, 2015 14:03
-
-
Save designbuildtest/10c68c382040d39d53bc to your computer and use it in GitHub Desktop.
Activate WebDevStudio's cmb class
This file contains hidden or 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 | |
| /** | |
| * Initialize Custom Metabox class. | |
| * https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress | |
| * https://github.com/mustardBees/cmb_field_map | |
| */ | |
| function sendtheme_initialize_metaboxes() { | |
| if ( !class_exists( 'cmb_Meta_Box' ) ) { | |
| require_once get_template_directory() . '/metaboxes-1.2.0/init.php'; | |
| } | |
| } | |
| add_action( 'init', 'sendtheme_initialize_metaboxes', 9999 ); | |
| /** | |
| * Add Custom Metaboxes. | |
| */ | |
| function sendtheme_create_metaboxes( $metaboxes ) { | |
| $metaboxes[0] = array( | |
| 'id' => 'geotagging_details', | |
| 'title' => __( 'Location details', 'mytheme' ), | |
| 'pages' => array( 'post' ), | |
| 'context' => 'normal', | |
| 'priority' => 'default', | |
| 'show_names' => true, | |
| 'fields' => array( | |
| array( | |
| 'name' => __( 'Location', 'mytheme' ), | |
| 'id' => 'geo', | |
| 'type' => 'pw_map', | |
| 'sanitization_cb' => 'pw_map_sanitise', | |
| ), | |
| array( | |
| 'name' => __( 'Public?', 'mytheme' ), | |
| 'id' => 'geo_public', | |
| 'type' => 'select', | |
| 'options' => array( | |
| array( 'name' => __( 'No', 'mytheme' ), 'value' => 'false', ), | |
| array( 'name' => __( 'Yes', 'mytheme' ), 'value' => 'true', ), | |
| ), | |
| ), | |
| ), | |
| ); | |
| return $metaboxes; | |
| } | |
| add_filter( 'cmb_meta_boxes' , 'sendtheme_create_metaboxes' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment