Skip to content

Commit

Permalink
examples: add multi_select and taxonomy_checkbox fields
Browse files Browse the repository at this point in the history
ref #44
  • Loading branch information
jkudish committed Feb 10, 2013
1 parent c1c6c61 commit 4860811
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions custom_metadata_examples.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function x_init_custom_fields() {
'group' => 'x_metaBox1',
'field_type' => 'radio',
'values' => array( // set possible value/options
'option1' => 'Option #1', // key => value pair (value is stored in DB)
'option1' => 'Option #1', // key => value pair (key is stored in DB)
'option2' => 'Option #2',
),
'label' => 'Radio field',
Expand All @@ -166,12 +166,33 @@ function x_init_custom_fields() {
'group' => 'x_metaBox1',
'field_type' => 'select',
'values' => array( // set possible value/options
'option1' => 'Option #1', // key => value pair (value is stored in DB)
'option2' => 'Option #2'
'option1' => 'Option #1', // key => value pair (key is stored in DB)
'option2' => 'Option #2',
),
'label' => 'Select field',
) );

// adds a multi-select field in the first group
x_add_metadata_field( 'x_field_multi_select', 'x_test', array(
'group' => 'x_metaBox1',
'field_type' => 'multi_select',
'values' => array( // set possible value/options
'option1' => 'Option #1', // key => value pair (key is stored in DB)
'option2' => 'Option #2',
'option3' => 'Option #3',
'option4' => 'Option #4',
),
'label' => 'Multi Select field',
) );

// adds a taxonomy checkbox field in the first group
x_add_metadata_field( 'x_field_taxonomy_checkbox', 'x_test', array(
'group' => 'x_metaBox1',
'field_type' => 'taxonomy_checkbox',
'taxonomy' => 'category',
'label' => 'Category checkbox field',
) );

// adds a field to posts and users
x_add_metadata_field( 'x_fieldName2', array( 'post', 'user' ), array(
'group' => 'x_metaBox2',
Expand Down

0 comments on commit 4860811

Please sign in to comment.