Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.91 KB | None | 0 0
  1. function mytheme_register_meta_boxes( $meta_boxes ){
  2.     $prefix = 'mytheme';
  3.  
  4.     // Page builder
  5.     $meta_boxes[] = array(
  6.         'id'       => $prefix . 'page_builder',
  7.         'title'    => esc_html__( 'Page Builder', 'mytheme' ),
  8.         'pages'    => array( 'page' ),
  9.         'context'  => 'normal',
  10.         'priority' => 'high',
  11.         'show'     => array(
  12.             'template'    => array( 'page-builder.php' ),
  13.         ),
  14.  
  15.         'fields' => array(
  16.             array(
  17.                 'id'            => $prefix . 'section',
  18.                 'type'          => 'group',
  19.                 'collapsible'   => true,
  20.                 'clone'         => true,
  21.                 'group_title'   => array(
  22.                     'field'     => 'section-select',
  23.                 ),
  24.                 'sort_clone'    => true,
  25.                 'save_state'    => true,
  26.                 // List of sub-fields
  27.                 'fields' => array(
  28.                     array(
  29.                         'name'          => esc_html__('Section', 'mytheme'),
  30.                         'id'            => 'section-select',
  31.                         'type'          => 'select',
  32.                         'placeholder'   => esc_html__( 'Select a layout', 'mytheme' ),
  33.                         'options'       => array(
  34.                             'fullwidth' => esc_html__( 'Fullwidth Section', 'mytheme' ),
  35.                             'with-sidebar' => esc_html__( 'With Sidebar Section', 'mytheme' ),
  36.                         ),
  37.                     ),
  38.                     array(
  39.                         'id'            => $prefix . 'section-main-col',
  40.                         'type'          => 'group',
  41.                         'collapsible'   => true,
  42.                         'clone'         => true,
  43.                         'group_title'   => array(
  44.                             'field'     => 'section-main-col-select',
  45.                         ),
  46.                         'sort_clone'    => true,
  47.                         'save_state'    => true,
  48.                         // List of sub-fields
  49.                         'fields'        => array(
  50.                             array(
  51.                                 'name'          => esc_html__('Section', 'mytheme'),
  52.                                 'id'            => 'section-main-col-select',
  53.                                 'type'          => 'select',
  54.                                 'placeholder'   => esc_html__( 'Select a layout', 'mytheme' ),
  55.                                 'options'       => array(
  56.                                     'posts-listing' => esc_html__( 'Posts Listing', 'mytheme' ),
  57.                                     'slider' => esc_html__( 'Slider', 'mytheme' ),
  58.                                 ),
  59.                             ),
  60.                         ),
  61.                     ),
  62.                 ),
  63.             ),
  64.            
  65.         ),
  66.     );
  67.  
  68.     return $meta_boxes;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement