Advertisement
keihead

Untitled

Dec 18th, 2013
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.13 KB | None | 0 0
  1. /*========================================
  2.         Texture Packs
  3. ========================================== */
  4. add_action('init', 'texturepacks_register');
  5. function texturepacks_register() {
  6.  
  7.     $labels = array(
  8.         'name' => _x('Texture Packs', 'post type general name'),
  9.         'singular_name' => _x('Texture Pack', 'post type singular name'),
  10.         'add_new' => _x('Add New', 'Texture Pack'),
  11.         'add_new_item' => __('Add New Texture Pack'),
  12.         'edit_item' => __('Edit Texture Pack'),
  13.         'new_item' => __('New Texture Pack'),
  14.         'view_item' => __('View Texture Pack'),
  15.         'search_items' => __('Search Texture Pack'),
  16.         'not_found' =>  __('Nothing found'),
  17.         'not_found_in_trash' => __('Nothing found in Trash'),
  18.         'parent_item_colon' => ''
  19.     );
  20.  
  21.     $args = array(
  22.         'labels' => $labels,
  23.         'public' => true,
  24.         'publicly_queryable' => true,
  25.         'show_ui' => true,
  26.         'query_var' => true,
  27.         'rewrite' => true,
  28.         'capability_type' => 'post',
  29.         'hierarchical' => false,
  30.         'menu_position' => 5,
  31.         'supports' => array('title')
  32.       );
  33.  
  34.     register_post_type( 'texturepacks' , $args );
  35. }
  36.  
  37.  
  38. add_filter( 'cmb_meta_boxes', 'cmb_sample_metaboxes' );
  39. /**
  40.  * Define the metabox and field configurations.
  41.  *
  42.  * @param  array $meta_boxes
  43.  * @return array
  44.  */
  45. function cmb_sample_metaboxes( array $meta_boxes ) {
  46.  
  47. $prefix = '_cmb_';
  48.  
  49.     $meta_boxes['test_metabox'] = array(
  50.         'id'         => 'test_metabox',
  51.         'title'      => __( 'Test Metabox', 'cmb' ),
  52.         'pages'      => array( 'page', 'texturepacks' ), // Post type
  53.         'context'    => 'normal',
  54.         'priority'   => 'high',
  55.         'show_names' => true, // Show field names on the left
  56.         // 'cmb_styles' => true, // Enqueue the CMB stylesheet on the frontend
  57.         'fields'     => array(
  58.             array(
  59.                 'name' => __( 'Test Text', 'cmb' ),
  60.                 'desc' => __( 'field description (optional)', 'cmb' ),
  61.                 'id'   => $prefix . 'test_text',
  62.                 'type' => 'text',
  63.                 // 'repeatable' => true,
  64.                 // 'on_front' => false, // Optionally designate a field to wp-admin only
  65.             ),
  66.             ));
  67.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement