If a specific value exists or any value at all?
Hi kalstrom,
Thanks for getting back to me.. You’re one of the developers of More Fields right?
I actually figured this out. I ended up using the get_meta() method to define the variables, then ran some conditional statements using empty() to check if a value had been set or not.. It worked like a charm!
My main problem was that I couldn’t remember the methods for pulling data from More Fields. As I remember, they weren’t WP methods, but specific to More Fields. Is that correct? Is get_meta() a More Fields method?
I remember you used to have some documentation on your old site. It would be great if you could add it to your new site.. I noticed you have the pages set-up, there just wasn’t anything there yet..
Thanks for all the hard work you put into the More plugins.. I really do appreciate it!
Dan
@danno63: It will be. We haven’t just gotten around to it yet.
@danno63: how did you accomplish this? i’m having the same problem. even though i used the following conditional statement on sites before the plugin was upgraded, but it’s no longer working:
<?php $exhibitionstartdate = date( "M j",strtotime( get_post_meta( $post->ID, 'exhibition_start_date', true ) ) ); if($exhibitionstartdate !== '') { echo '<div class="cf-exhibition-date"><span>Exhibition Date: </span>' .$exhibitionstartdate; } ?>
jan 1, 1970 shows up. the same for time fields. 12:00am – 12: 00am shows up even though the field is completely empty.
@kalstrom: if you have any ideas how to implement a conditional, it would be great to know.
Forget it. Figured it out myself. Just had to change the strtotime to echo rather than as part of the variable:
<?php $exhibitionstartdate = get_post_meta( $post->ID, 'exhibition_start_date', true ); if(!empty($exhibitionstartdate)) { echo '<div class="cf-exhibition-date"><span>Exhibition Date: </span>' .date( "M j",strtotime( $exhibitionstartdate ) ); } ?>
Weird. Couldn’t find a solution anywhere on the net, and just kept playing around with it…