wp/wp-content/plugins/option-tree/assets/theme-mode/demo-meta-boxes.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 11 bf1778c34b9a
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
     1 <?php
     1 <?php
     2 /**
     2 /**
     3  * Initialize the meta boxes. 
     3  * Initialize the custom Meta Boxes. 
     4  */
     4  */
     5 add_action( 'admin_init', '_custom_meta_boxes' );
     5 add_action( 'admin_init', 'custom_meta_boxes' );
     6 
     6 
     7 /**
     7 /**
     8  * Meta Boxes demo code.
     8  * Meta Boxes demo code.
     9  *
     9  *
    10  * You can find all the available option types
    10  * You can find all the available option types in demo-theme-options.php.
    11  * in demo-theme-options.php.
       
    12  *
    11  *
    13  * @return    void
    12  * @return    void
    14  *
       
    15  * @access    private
       
    16  * @since     2.0
    13  * @since     2.0
    17  */
    14  */
    18 function _custom_meta_boxes() {
    15 function custom_meta_boxes() {
    19   
    16   
    20   /**
    17   /**
    21    * Create a custom meta boxes array that we pass to 
    18    * Create a custom meta boxes array that we pass to 
    22    * the OptionTree Meta Box API Class.
    19    * the OptionTree Meta Box API Class.
    23    */
    20    */
    24   $my_meta_box = array(
    21   $my_meta_box = array(
    25     'id'          => 'my_meta_box',
    22     'id'          => 'demo_meta_box',
    26     'title'       => 'Demo Meta Box',
    23     'title'       => __( 'Demo Meta Box', 'theme-text-domain' ),
    27     'desc'        => '',
    24     'desc'        => '',
    28     'pages'       => array( 'post' ),
    25     'pages'       => array( 'post' ),
    29     'context'     => 'normal',
    26     'context'     => 'normal',
    30     'priority'    => 'high',
    27     'priority'    => 'high',
    31     'fields'      => array(
    28     'fields'      => array(
    32       array(
    29       array(
    33         'label'       => 'Background',
    30         'label'       => __( 'Conditions', 'theme-text-domain' ),
    34         'id'          => 'my_background',
    31         'id'          => 'demo_conditions',
    35         'type'        => 'background',
    32         'type'        => 'tab'
    36         'desc'        => 'BlahLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
       
    37         'std'         => '',
       
    38         'rows'        => '',
       
    39         'post_type'   => '',
       
    40         'taxonomy'    => '',
       
    41         'class'       => ''
       
    42       ),
    33       ),
    43       array(
    34       array(
    44         'label'       => 'Category Checkbox',
    35         'label'       => __( 'Show Gallery', 'theme-text-domain' ),
    45         'id'          => 'my_category_checkbox',
    36         'id'          => 'demo_show_gallery',
    46         'type'        => 'category-checkbox',
    37         'type'        => 'on-off',
    47         'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
    38         'desc'        => sprintf( __( 'Shows the Gallery when set to %s.', 'theme-text-domain' ), '<code>on</code>' ),
    48         'std'         => '',
    39         'std'         => 'off'
    49         'rows'        => '',
    40       ),
    50         'post_type'   => '',
    41       array(
    51         'taxonomy'    => '',
    42         'label'       => '',
    52         'class'       => ''
    43         'id'          => 'demo_textblock',
       
    44         'type'        => 'textblock',
       
    45         'desc'        => __( 'Congratulations, you created a gallery!', 'theme-text-domain' ),
       
    46         'operator'    => 'and',
       
    47         'condition'   => 'demo_show_gallery:is(on),demo_gallery:not()'
       
    48       ),
       
    49       array(
       
    50         'label'       => __( 'Gallery', 'theme-text-domain' ),
       
    51         'id'          => 'demo_gallery',
       
    52         'type'        => 'gallery',
       
    53         'desc'        => sprintf( __( 'This is a Gallery option type. It displays when %s.', 'theme-text-domain' ), '<code>demo_show_gallery:is(on)</code>' ),
       
    54         'condition'   => 'demo_show_gallery:is(on)'
       
    55       ),
       
    56       array(
       
    57         'label'       => __( 'More Options', 'theme-text-domain' ),
       
    58         'id'          => 'demo_more_options',
       
    59         'type'        => 'tab'
       
    60       ),
       
    61       array(
       
    62         'label'       => __( 'Text', 'theme-text-domain' ),
       
    63         'id'          => 'demo_text',
       
    64         'type'        => 'text',
       
    65         'desc'        => __( 'This is a demo Text field.', 'theme-text-domain' )
       
    66       ),
       
    67       array(
       
    68         'label'       => __( 'Textarea', 'theme-text-domain' ),
       
    69         'id'          => 'demo_textarea',
       
    70         'type'        => 'textarea',
       
    71         'desc'        => __( 'This is a demo Textarea field.', 'theme-text-domain' )
    53       )
    72       )
    54     )
    73     )
    55   );
    74   );
    56   
    75   
    57   /**
    76   /**
    58    * Register our meta boxes using the 
    77    * Register our meta boxes using the 
    59    * ot_register_meta_box() function.
    78    * ot_register_meta_box() function.
    60    */
    79    */
    61   ot_register_meta_box( $my_meta_box );
    80   if ( function_exists( 'ot_register_meta_box' ) )
       
    81     ot_register_meta_box( $my_meta_box );
    62 
    82 
    63 }
    83 }