WordPress.org

Ready to get started?Download WordPress

Forums

More Fields
More Fields plugin - documentation & check if value exists (6 posts)

  1. danno63
    Member
    Posted 3 years ago #

    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

  2. kalstrom
    Member
    Plugin Author

    Posted 3 years ago #

    If a specific value exists or any value at all?

  3. danno63
    Member
    Posted 3 years ago #

    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

  4. kalstrom
    Member
    Plugin Author

    Posted 3 years ago #

    @danno63: It will be. We haven't just gotten around to it yet.

  5. manon1165
    Member
    Posted 3 years ago #

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

  6. manon1165
    Member
    Posted 3 years ago #

    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...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic