Version 1.0.0
PHP Framework for wordpress theme developer to automatically register the metabox with some kind of field types. With various function to make register metabox fields with clean and easy code.
Step 1 : Dowload the arad wp fields from here
Step 2 : Extract the folder to your some location of your wordpress theme.
Step 3 : Include the arad_fields_class.php to your php file (this file will be included at your function.php)
/**
* Including arad wp fields framework
*
*/
if (!class_exists('arad_fields_class') && file_exists(get_template_directory().'/includes/arad-wp-fields-master/arad_fields_class.php')) {
require_once(get_template_directory().'/includes/arad-wp-fields-master/arad_fields_class.php');
if(!class_exists('arad_fields_class')){
return;
}
}
Step 4 : Declare the url location of the arad wp fields folder.
/**
* Declare the uri of arad wp field folder
*
*/
arad_fields_class::$arad_dir = get_template_directory_uri().'/includes/arad-wp-fields-master';
Step 5 : Add a metabox.
/**
* add Meta Box
*
*/
arad_fields_class::addMetaBox(
array(
'title' => 'Review Score',
'screen' => 'post',
'context' => 'normal',
'fields' =>
array(
array(
'title' => 'Score',
'name' => 'score',
'type' => 'range',
'min' => '0',
'max' => '100'
),
)
)
);
Step 6 : Create the Metabox.
/**
* create Meta Box
*
*/
arad_fields_class::createMetaBox();
- Type : text
- Options : title, name, div_class, id
- Example :
array(
'type' => 'text',
'title' => 'Input Text',
'name' => 'name',
'div_class' => 'name_class',
'id' => 'name_id'
)
- Type : range
- Options : title, name, div_class, id, min, max
- Example :
array(
'type' => 'range',
'title' => 'Distance',
'name' => 'distance',
'div_class' => 'distance_class',
'id' => 'distance_id',
'min' => 0,
'max' => 100
)
- Type : images
- Options : title, name, div_class, id
- Example :
array(
'type' => 'images',
'title' => 'Gallery',
'name' => 'gallery',
'div_class' => 'gallery_class',
'id' => 'gallery_id'
)
- Type : video
- Options : title, name, div_class, id
- Example :
array(
'type' => 'video',
'title' => 'Trailer',
'name' => 'trailer',
'div_class' => 'trailer_class',
'id' => 'trailer_id'
)
- Type : audio
- Options : title, name, div_class, id
- Example :
array(
'type' => 'audio',
'title' => 'Sound Wave',
'name' => 'sound_wave',
'div_class' => 'sound_wave_class',
'id' => 'soundwave_id'
)
- Type : select
- Options : title, name, div_class, id, options
- Example :
array(
'type' => 'select',
'title' => 'Gender',
'name' => 'gender',
'div_class' => 'gender_class',
'id' => 'gender_id',
'options' => array(
'male' => 'Male',
'female' => 'Female'
)
)
You can take look to another example of Meta Box here.
Version 1.0.0
- Add metabox, create metabox.