wp/wp-content/plugins/option-tree/assets/theme-mode/demo-meta-boxes.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 11 bf1778c34b9a
--- a/wp/wp-content/plugins/option-tree/assets/theme-mode/demo-meta-boxes.php	Mon Jun 08 16:11:51 2015 +0000
+++ b/wp/wp-content/plugins/option-tree/assets/theme-mode/demo-meta-boxes.php	Tue Jun 09 03:35:32 2015 +0200
@@ -1,55 +1,74 @@
 <?php
 /**
- * Initialize the meta boxes. 
+ * Initialize the custom Meta Boxes. 
  */
-add_action( 'admin_init', '_custom_meta_boxes' );
+add_action( 'admin_init', 'custom_meta_boxes' );
 
 /**
  * Meta Boxes demo code.
  *
- * You can find all the available option types
- * in demo-theme-options.php.
+ * You can find all the available option types in demo-theme-options.php.
  *
  * @return    void
- *
- * @access    private
  * @since     2.0
  */
-function _custom_meta_boxes() {
+function custom_meta_boxes() {
   
   /**
    * Create a custom meta boxes array that we pass to 
    * the OptionTree Meta Box API Class.
    */
   $my_meta_box = array(
-    'id'          => 'my_meta_box',
-    'title'       => 'Demo Meta Box',
+    'id'          => 'demo_meta_box',
+    'title'       => __( 'Demo Meta Box', 'theme-text-domain' ),
     'desc'        => '',
     'pages'       => array( 'post' ),
     'context'     => 'normal',
     'priority'    => 'high',
     'fields'      => array(
       array(
-        'label'       => 'Background',
-        'id'          => 'my_background',
-        'type'        => 'background',
-        'desc'        => 'BlahLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
-        'std'         => '',
-        'rows'        => '',
-        'post_type'   => '',
-        'taxonomy'    => '',
-        'class'       => ''
+        'label'       => __( 'Conditions', 'theme-text-domain' ),
+        'id'          => 'demo_conditions',
+        'type'        => 'tab'
+      ),
+      array(
+        'label'       => __( 'Show Gallery', 'theme-text-domain' ),
+        'id'          => 'demo_show_gallery',
+        'type'        => 'on-off',
+        'desc'        => sprintf( __( 'Shows the Gallery when set to %s.', 'theme-text-domain' ), '<code>on</code>' ),
+        'std'         => 'off'
+      ),
+      array(
+        'label'       => '',
+        'id'          => 'demo_textblock',
+        'type'        => 'textblock',
+        'desc'        => __( 'Congratulations, you created a gallery!', 'theme-text-domain' ),
+        'operator'    => 'and',
+        'condition'   => 'demo_show_gallery:is(on),demo_gallery:not()'
       ),
       array(
-        'label'       => 'Category Checkbox',
-        'id'          => 'my_category_checkbox',
-        'type'        => 'category-checkbox',
-        'desc'        => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
-        'std'         => '',
-        'rows'        => '',
-        'post_type'   => '',
-        'taxonomy'    => '',
-        'class'       => ''
+        'label'       => __( 'Gallery', 'theme-text-domain' ),
+        'id'          => 'demo_gallery',
+        'type'        => 'gallery',
+        'desc'        => sprintf( __( 'This is a Gallery option type. It displays when %s.', 'theme-text-domain' ), '<code>demo_show_gallery:is(on)</code>' ),
+        'condition'   => 'demo_show_gallery:is(on)'
+      ),
+      array(
+        'label'       => __( 'More Options', 'theme-text-domain' ),
+        'id'          => 'demo_more_options',
+        'type'        => 'tab'
+      ),
+      array(
+        'label'       => __( 'Text', 'theme-text-domain' ),
+        'id'          => 'demo_text',
+        'type'        => 'text',
+        'desc'        => __( 'This is a demo Text field.', 'theme-text-domain' )
+      ),
+      array(
+        'label'       => __( 'Textarea', 'theme-text-domain' ),
+        'id'          => 'demo_textarea',
+        'type'        => 'textarea',
+        'desc'        => __( 'This is a demo Textarea field.', 'theme-text-domain' )
       )
     )
   );
@@ -58,6 +77,7 @@
    * Register our meta boxes using the 
    * ot_register_meta_box() function.
    */
-  ot_register_meta_box( $my_meta_box );
+  if ( function_exists( 'ot_register_meta_box' ) )
+    ot_register_meta_box( $my_meta_box );
 
 }
\ No newline at end of file