WordPress.org

Support

Support » Plugins and Hacks » More Fields plugin – documentation & check if value exists

More Fields plugin – documentation & check if value exists

  • I’m using the More Fields plugin on a few sites. I recently noticed that the developers have updated their website and that the documentation is no longer available. Does anyone know where to find it?

    I’ve been using the meta() tag to display More Field (Custom meta) values. I’d like to be able to check to see if a value exists to use in a conditional statement, but can’t seem to figure out how to do that. Does anyone have any ideas?

    Thanks!
    Dan

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author kalstrom
    Member

    @kalstrom

    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

    Plugin Author kalstrom
    Member

    @kalstrom

    @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…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘More Fields plugin – documentation & check if value exists’ is closed to new replies.