Advertisement
firoze

icon from select option BY Meta Box

Oct 30th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1. // if user want to select icon from select option
  2.  
  3. $meta_boxes['test_metabox'] = array(
  4.         'id'         => 'test_metabox',
  5.         'title'      => __( 'Font Awesome', 'cmb' ),
  6.         'pages'      => array( 'acme_product', ), // Post type
  7.         'context'    => 'normal',
  8.         'priority'   => 'high',
  9.         'show_names' => true, // Show field names on the left
  10.         // 'cmb_styles' => true, // Enqueue the CMB stylesheet on the frontend
  11.         'fields'     => array(
  12.             array(
  13.                 'name'       => __( 'Font Awesome', 'cmb' ),
  14.                 'desc'       => __( 'write your icon name', 'cmb' ),
  15.                 'id'         =>'promo-icon',
  16.                 'type'       => 'select',
  17.                 'show_on_cb' => 'cmb_test_text_show_on_cb', // function should return a bool value
  18.                 // 'sanitization_cb' => 'my_custom_sanitization', // custom sanitization callback parameter
  19.                 // 'escape_cb'       => 'my_custom_escaping',  // custom escaping callback parameter
  20.                 // 'on_front'        => false, // Optionally designate a field to wp-admin only
  21.                 // 'repeatable'      => true,
  22.                 'options' => array(
  23.                     'Home' => __( 'Home Icon', 'cmb' ),
  24.                     'facebook'   => __( 'Facebook Icon', 'cmb' ),
  25.                     'Twitter'     => __( 'Twitter Icon', 'cmb' ),
  26.                     'search'     => __( 'Search Icon', 'cmb' ),
  27.                 ),
  28.             ),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement