Viewing 2 reply threads
  • Author
    Posts
    • #5936
      jrcreative
      Member

      When I pull field data from a select, is there any way to access the value, instead of just the key?

      For example, my field is set up like this.


      piklist('field', array(
      'type' => 'select'
      ,'field' => 'time_off_type'
      ,'label' => 'Time-off Type'
      ,'description' => 'Choose from the drop-down.'
      ,'help' => 'Choose your time off type'
      ,'attributes' => array(
      'class' => 'text'
      )
      ,'choices' => array(
      'vacation' => 'Vacation'
      ,'comp_time' => 'Comp Time'
      ,'sick' => 'Sick'
      )
      ));

      get_post_meta() displays the key, and I’d like the value. Do I need to write something on the template side to display like that, or is the value stored in the database somewhere I’m not looking?

      As it is now all I would get is something like: time_off_type => sick

    • #5937
      Steve
      Keymaster

      @jrcreative Welcome to the Piklist community!

      Currently there’s no way to access the value. You have to write a function on the template side.

    • #5939
      jrcreative
      Member

      okay, thanks. I’ll do that.

Viewing 2 reply threads
  • The topic ‘Display from select in template’ is closed to new replies.