Skip to content

Commit

Permalink
Fixed #74
Browse files Browse the repository at this point in the history
  • Loading branch information
bainternet committed May 6, 2013
1 parent f1dfa0d commit 92356c5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 32 deletions.
3 changes: 3 additions & 0 deletions README
Expand Up @@ -29,6 +29,9 @@ Reapater field can't handle Posts and Taxonomy for now (and maybe even others).

Changelog
---------
= 3.0.6 =
Fixed issue #74.

= 3.0.5 =
Fixed issue #64

Expand Down
77 changes: 46 additions & 31 deletions class-usage-demo.php
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Demo MetaBox
Plugin URI: http://en.bainternet.info
Description: My Meta Box Class usage demo
Version: 3.0.5
Version: 3.0.6
Author: Bainternet, Ohad Raz
Author URI: http://en.bainternet.info
*/
Expand All @@ -22,13 +22,13 @@
* configure your meta box
*/
$config = array(
'id' => 'demo_meta_box', // meta box id, unique per meta box
'title' => 'Simple Meta Box fields', // meta box title
'pages' => array('post', 'page'), // post types, accept custom post types as well, default is array('post'); optional
'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
'priority' => 'high', // order of meta box: high (default), low; optional
'fields' => array(), // list of meta fields (can be added by field arrays)
'local_images' => false, // Use local or hosted images (meta box images for add/remove)
'id' => 'demo_meta_box', // meta box id, unique per meta box
'title' => 'Simple Meta Box fields', // meta box title
'pages' => array('post', 'page'), // post types, accept custom post types as well, default is array('post'); optional
'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
'priority' => 'high', // order of meta box: high (default), low; optional
'fields' => array(), // list of meta fields (can be added by field arrays)
'local_images' => false, // Use local or hosted images (meta box images for add/remove)
'use_with_theme' => false //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
);

Expand Down Expand Up @@ -57,9 +57,9 @@
//file upload field
$my_meta->addFile($prefix.'file_field_id',array('name'=> 'My File '));
/*
* Don't Forget to Close up the meta box decleration
* Don't Forget to Close up the meta box Declaration
*/
//Finish Meta Box Decleration
//Finish Meta Box Declaration
$my_meta->Finish();

/**
Expand All @@ -69,13 +69,13 @@
* configure your meta box
*/
$config2 = array(
'id' => 'demo_meta_box2', // meta box id, unique per meta box
'title' => 'Advanced Meta Box fields', // meta box title
'pages' => array('post', 'page'), // post types, accept custom post types as well, default is array('post'); optional
'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
'priority' => 'high', // order of meta box: high (default), low; optional
'fields' => array(), // list of meta fields (can be added by field arrays)
'local_images' => false, // Use local or hosted images (meta box images for add/remove)
'id' => 'demo_meta_box2', // meta box id, unique per meta box
'title' => 'Advanced Meta Box fields', // meta box title
'pages' => array('post', 'page'), // post types, accept custom post types as well, default is array('post'); optional
'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
'priority' => 'high', // order of meta box: high (default), low; optional
'fields' => array(), // list of meta fields (can be added by field arrays)
'local_images' => false, // Use local or hosted images (meta box images for add/remove)
'use_with_theme' => false //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
);

Expand Down Expand Up @@ -103,7 +103,11 @@
//posts field
$my_meta2->addPosts($prefix.'posts_field_id',array('post_type' => 'post'),array('name'=> 'My Posts '));
//add Code editor field
$my_meta2->addCode($prefix.'code_field_id',array('name'=> 'Code editor Field', 'syntax' => 'php','theme' => 'light'));
$my_meta2->addCode($prefix.'code_field_id',array(
'name' => 'Code editor Field',
'syntax' => 'php',
'theme' => 'light'
));

/*
* To Create a reapeater Block first create an array of fields
Expand All @@ -118,7 +122,12 @@
* Then just add the fields to the repeater block
*/
//repeater block
$my_meta2->addRepeaterBlock($prefix.'re_',array('inline' => true, 'name' => 'This is a Repeater Block','fields' => $repeater_fields, 'sortable'=> true));
$my_meta2->addRepeaterBlock($prefix.'re_',array(
'inline' => true,
'name' => 'This is a Repeater Block',
'fields' => $repeater_fields,
'sortable' => true
));

/*
* To Create a conditinal Block first create an array of fields
Expand All @@ -135,28 +144,28 @@
//repeater block
$my_meta2->addCondition('conditinal_fields',
array(
'name'=> __('Enable conditinal fields? ','mmb'),
'desc' => __('<small>Turn ON if you want to enable the <strong>conditinal fields</strong>.</small>','mmb'),
'name' => __('Enable conditinal fields? ','mmb'),
'desc' => __('<small>Turn ON if you want to enable the <strong>conditinal fields</strong>.</small>','mmb'),
'fields' => $Conditinal_fields,
'std' => false
'std' => false
));

/*
* Don't Forget to Close up the meta box decleration
* Don't Forget to Close up the meta box Declaration
*/
//Finish Meta Box Decleration
//Finish Meta Box Declaration
$my_meta2->Finish();


$prefix = "_groupped_";
$config3 = array(
'id' => 'demo_meta_box3', // meta box id, unique per meta box
'title' => 'Groupped Meta Box fields', // meta box title
'pages' => array('post', 'page'), // post types, accept custom post types as well, default is array('post'); optional
'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
'priority' => 'low', // order of meta box: high (default), low; optional
'fields' => array(), // list of meta fields (can be added by field arrays)
'local_images' => false, // Use local or hosted images (meta box images for add/remove)
'id' => 'demo_meta_box3', // meta box id, unique per meta box
'title' => 'Groupped Meta Box fields', // meta box title
'pages' => array('post', 'page'), // post types, accept custom post types as well, default is array('post'); optional
'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
'priority' => 'low', // order of meta box: high (default), low; optional
'fields' => array(), // list of meta fields (can be added by field arrays)
'local_images' => false, // Use local or hosted images (meta box images for add/remove)
'use_with_theme' => false //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
);

Expand All @@ -177,4 +186,10 @@
$my_meta3->addSelect($prefix.'select_field_id',array('selectkey1'=>'Select Value1','selectkey2'=>'Select Value2'),array('name'=> 'My select ', 'std'=> array('selectkey2')));
//radio field
$my_meta3->addRadio($prefix.'radio_field_id',array('radiokey1'=>'Radio Value1','radiokey2'=>'Radio Value2'),array('name'=> 'My Radio Filed', 'std'=> array('radionkey2'),'group' => 'end'));

/*
* Don't Forget to Close up the meta box Declaration
*/
//Finish Meta Box Declaration
$my_meta3->Finish();
}
2 changes: 1 addition & 1 deletion meta-box-class/my-meta-box-class.php
Expand Up @@ -12,7 +12,7 @@
* modify and change small things and adding a few field types that i needed to my personal preference.
* The original author did a great job in writing this class, so all props goes to him.
*
* @version 3.0.5
* @version 3.0.6
* @copyright 2011 - 2013
* @author Ohad Raz (email: admin@bainternet.info)
* @link http://en.bainternet.info
Expand Down

0 comments on commit 92356c5

Please sign in to comment.