Support » Plugin: WP Easy Post Types » [Plugin: WP Easy Post Types] Select Lists are displaying empty values?

  • Hi Guys.

    I created a custom field with a select list and I entered values. When I go to the custom post type and add new content, the dropdown list shows blank values, but if I look at the source code, the values are defined in there … they’re just not visible.

    I’m running the standard wordpress admin theme, so I have no idea what the issue is?

    Just to give you an idea of the code being generated:

    <div class="field-phone_os field-phone_os">
                <span class="label">Operating System</span>
    <select name="phone_os">
            <option  value="Android 1.5 Cupcake"></option>
            <option  value="Android 1.6 Donut"></option>
            <option  value="Android 2.1 Eclair"></option>
            <option  value="Android 2.2 Froyo"></option>
            <option  value="Android 3.0 Gingerbread"></option>



Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Itai,
    I have the same problem. I was able to change one line of code in the plug-in, and the select drop down now displays values and text in the select control. This seems like the wrong thing to do, but works in the interim until someone can explain how this should properly work.

    In the file /classes/custom-select/theme-select-input.php, line 7,

    <option <?php print $option['selected']; ?> value="<?php print $option['key']; ?>"><?php print $option['value']; ?></option>

    I changed the second value to key
    <option <?php print $option['selected']; ?> value="<?php print $option['key']; ?>"><?php print $option['key']; ?></option>

    You need to input the list in a [key]|[value] format like this:


    This would render as

    <option value="1">Monday</option>
    <option value="2">Tuesday</option>
    ... and so on.

    Hope this helps.

    BTW, the logic can be found in easy-post-types/classes/custom-select/custom-select.php in the function prepareArray().

    If you want to use PHP the generate the list, your code needs to return an array like this:

    return array(
       array(1, 'Monday'),
       array(2, 'Tuesday'),
       ... and so on.

    Perfect…thanks Itst for clarifying. Very much appreciated.

    Thanks Itst 🙂

    cheers itst! been wondering that for months!

    Seems to be a few ways to display the selected value in a template.
    With a custom select field called weekday, with the label “Day” and content:

    The “snippit” way:
    <?php the_ept_field('weekday'); ?>
    Displays e.g. Day Monday

    <?php echo get_ept_field('weekday'); ?>
    Displays e.g. Day Monday

    To just get the value so you can use your own label then you’d think you could use:
    <?php echo get_ept_field('weekday',array('raw' => 'true')); ?>
    or alternatively:
    <?php echo get_post_meta($post->ID,'weekday',true) ?>
    But both these display 1 (the value of the select option rather than the text of the option)

    How can you just get the text? I can remove the label e.g.
    <?php echo preg_replace('/Day/','',get_ept_field('weekday'),1); ?>

    But there must be an easier way?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: WP Easy Post Types] Select Lists are displaying empty values?’ is closed to new replies.