I'm using WP Types to create a real estate site. I've created a group with a select field to store prices for the properties. The price is stored in $100,000 increments. The display text is:
$0-$100,000
$100,000-200,000
$200,000-300,000
.
.
.
$1,000,000+
and the Custom field content is:
0
100000
200000
300000
.
.
.
1000000
I've created some test properties with the price added to them. However, when I create a view to list my properties with the price, beds, baths, etc. Any property that has $0-$100,000 as the price shows the price as blank. Any other properties lists the display price as expected (ex. $100,000-200,000). All of the other property fields such as city, beds, baths, notes, etc. display normally. Beds and Baths are also select fields and they appear to be working normally.
I don't think there's anything usual about the code in the view for this:
[types field='property-price'][/types]
I've also tried it with the output='raw' and it is still blank. Is there a step I've skipped along the way?
Please let me know if I can provide more detail on this issue.
Thanks,
Collin Condray
Director of Technology
BlueZooCreative.com
Hi, this looks like a nuance in the way "zero" values are handled in shortcodes and conditionals. Ideally none of the options in a field should have a content value of 0, because that can cause problems in determining whether or not the field is set. If you're just getting started, I recommend changing this option value to be 1 or something else. Then resave any posts that you have already created with the 0 option selected, so the value will be updated in the database for all posts. This is the best long-term solution.
If you've got a large site built already and other functionality built around this custom field value being 0, then you can get around the problem with a conditional that tests an explicit zero value like this:
[wpv-conditional if="( $(wpcf-property-price) eq '0' )"]
0-$100,000
[/wpv-conditional]
However I only recommend this as a last resort, since zero values can cause other unexpected problems in searching and filtering.
That did the trick! Thanks for your help!