Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*========================================
- Texture Packs
- ========================================== */
- add_action('init', 'texturepacks_register');
- function texturepacks_register() {
- $labels = array(
- 'name' => _x('Texture Packs', 'post type general name'),
- 'singular_name' => _x('Texture Pack', 'post type singular name'),
- 'add_new' => _x('Add New', 'Texture Pack'),
- 'add_new_item' => __('Add New Texture Pack'),
- 'edit_item' => __('Edit Texture Pack'),
- 'new_item' => __('New Texture Pack'),
- 'view_item' => __('View Texture Pack'),
- 'search_items' => __('Search Texture Pack'),
- 'not_found' => __('Nothing found'),
- 'not_found_in_trash' => __('Nothing found in Trash'),
- 'parent_item_colon' => ''
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'query_var' => true,
- 'rewrite' => true,
- 'capability_type' => 'post',
- 'hierarchical' => false,
- 'menu_position' => 5,
- 'supports' => array('title')
- );
- register_post_type( 'texturepacks' , $args );
- }
- add_filter( 'cmb_meta_boxes', 'cmb_sample_metaboxes' );
- /**
- * Define the metabox and field configurations.
- *
- * @param array $meta_boxes
- * @return array
- */
- function cmb_sample_metaboxes( array $meta_boxes ) {
- $prefix = '_cmb_';
- $meta_boxes['test_metabox'] = array(
- 'id' => 'test_metabox',
- 'title' => __( 'Test Metabox', 'cmb' ),
- 'pages' => array( 'page', 'texturepacks' ), // Post type
- 'context' => 'normal',
- 'priority' => 'high',
- 'show_names' => true, // Show field names on the left
- // 'cmb_styles' => true, // Enqueue the CMB stylesheet on the frontend
- 'fields' => array(
- array(
- 'name' => __( 'Test Text', 'cmb' ),
- 'desc' => __( 'field description (optional)', 'cmb' ),
- 'id' => $prefix . 'test_text',
- 'type' => 'text',
- // 'repeatable' => true,
- // 'on_front' => false, // Optionally designate a field to wp-admin only
- ),
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement