From 4860811d4e5386bef48f9aa4adbdee427a349cbf Mon Sep 17 00:00:00 2001 From: Joey Kudish Date: Sat, 9 Feb 2013 17:07:50 -0800 Subject: [PATCH] examples: add multi_select and taxonomy_checkbox fields ref #44 --- custom_metadata_examples.php | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/custom_metadata_examples.php b/custom_metadata_examples.php index f168846..081cf23 100644 --- a/custom_metadata_examples.php +++ b/custom_metadata_examples.php @@ -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', @@ -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',