Support

Account

Forum Replies Created

  • Thanks Elliot,

    I upgraded my php to 5.3 and no change. The code I posted works great, it’s just when I try to reformat the display date, it breaks. Maybe I’m missing something on how I’m implementing it.

    Where in my above code would I add this code to reformat? Also, did I customize this correctly to fit my use?

    $date = DateTime::createFromFormat(‘Ymd’, get_field(‘onsale’));
    echo $date->format(‘D, m y’);

    Thanks again!

  • I’m having this same issue, trying to get the date to automatically display formatted like “Mon July, 29”.

    If I use the code above, it breaks the page and nothing will load. Any thoughts on this? I love this plugin by the way!

    Here is the code that I’m using. The “onsale” field is the Date Picker and I would like to reformat how it displays on the page. Thanks!

    <?php
    $onsale_date = strtotime(get_field(‘onsale’));
    $now = time();

    if ($onsale_date > $now) {
    ?>
    On Sale

    <?php
    echo get_field( ‘onsale’ );
    }
    else { echo get_field( ‘price’ );
    }
    ?>

Viewing 2 posts - 1 through 2 (of 2 total)