Advertisement
Guest User

Untitled

a guest
Nov 18th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.05 KB | None | 0 0
  1. function rw_register_meta_boxes($meta_boxes) {
  2.    
  3.     global $prefix;
  4.  
  5.     $meta_boxes = array();
  6.     $meta_boxes[] = array(
  7.         'title'  => __( 'Page Banners', 'ok' ),
  8.         'pages'  => array( 'page' ),
  9.         'fields' => array(
  10.             array(
  11.                 'name' => __( 'Full viewport height:', 'ok' ),
  12.                 'id'   => "{$prefix}full_height",
  13.                 'type' => 'checkbox',
  14.             ),
  15.             array(
  16.                 'name' => __( 'Common Banner Image:', 'ok' ),
  17.                 'id'   => "{$prefix}common_image",
  18.                 'type' => 'image_advanced',
  19.                 'max_file_uploads' => 1
  20.             ),
  21.             array(
  22.                 'name' => '',
  23.                 'id'   => "{$prefix}separator",
  24.                 'type' => 'divider',
  25.             ),
  26.             array(
  27.                 'id' => 'banner_slides',
  28.                 'type' => 'group',
  29.                 'clone'  => true,
  30.                 'fields' => array(
  31.                     array(
  32.                         'name' => 'Line 1:',
  33.                         'id' => "{$prefix}banner_line_1",
  34.                         'type' => 'text',
  35.                     ),
  36.                     array(
  37.                         'name' => 'Line 2:',
  38.                         'id' => "{$prefix}banner_line_2",
  39.                         'type' => 'text',
  40.                     ),
  41.                     array(
  42.                         'name' => 'Description:',
  43.                         'id' => "{$prefix}banner_desc",
  44.                         'type' => 'textarea',
  45.                     ),
  46.                     array(
  47.                         'name' => 'Image:',
  48.                         'id' => "{$prefix}banner_image",
  49.                         'type' => 'image_advanced',
  50.                         'max_file_uploads' => 1
  51.                     ),
  52.                     array(
  53.                         'name' => 'URL:',
  54.                         'id' => "{$prefix}banner_url",
  55.                         'type' => 'text',
  56.                         'desc' => 'Please use full URL including http://'
  57.                     ),
  58.                 ),
  59.             ),
  60.         )
  61.     );
  62.  
  63.     if ( class_exists( 'RW_Meta_Box' ) ) {
  64.         foreach ( $meta_boxes as $meta_box ) {
  65.             if ( isset( $meta_box['only_on'] ) && ! rw_maybe_include( $meta_box['only_on'] ) ) {
  66.                 continue;
  67.             }
  68.             new RW_Meta_Box( $meta_box );
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement