Viewing 2 reply threads
  • Author
    Posts
    • #1815
      civilz
      Member

      hi
      my code :

      piklist('field', array(
          'type' => 'select'
          ,'field' => 'j_select'
          ,'label' => 'Select Box'
          ,'description' => 'Choose from the drop-down.'
          ,'help' => 'This is help text.'
          ,'attributes' => array(
            'class' => 'text'
          )
          ,'choices' => array(
            'option1' => 'red'
            ,'option2' => 'blue'
            ,'option3' => 'yellow'
          )
        ));

      and use in loop (single.php) :

      
      color : <?php  echo get_post_meta($post->ID,'j_select', true);?>
      

      but result :
      color : option1

      text feild is work good but select and checkbox dont work !!!

      please help me …

    • #1816
      Steve
      Keymaster

      This is working correctly. The KEY, “option1”, is being saved. You would either need to change the key to “red”, or convert it from key to value. Probably the easiest way is the change the choices array:

      piklist('field', array(
          'type' => 'select'
          ,'field' => 'j_select'
          ,'label' => 'Select Box'
          ,'description' => 'Choose from the drop-down.'
          ,'help' => 'This is help text.'
          ,'attributes' => array(
            'class' => 'text'
          )
          ,'choices' => array(
            'red' => 'red'
            ,'blue' => 'blue'
            ,'yellow' => 'yellow'
          )
        ));
    • #1817
      civilz
      Member

      thanks. ♥

Viewing 2 reply threads
  • The topic ‘dont display value in metabox’ is closed to new replies.