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:
1|Monday
2|Tuesday
3|Wednesday
4|Thursday
5|Friday
6|Saturday
7|Sunday
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.
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:
1|Monday
2|Tuesday
3|Wednesday
4|Thursday
5|Friday
6|Saturday
7|Sunday
The “snippit” way:
<?php the_ept_field('weekday'); ?>
Displays e.g. Day Monday
or:
<?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?