Forums

Custom Field Template
Get today's date and compare to value in date picker (3 posts)

  1. Ericka125
    Member
    Posted 6 months ago #

    I am currently using Custom Field Template. I need to make everything as simple as possible for the client, and so to make an event I've created a custom field with the date picker tool displaying the date as mm/dd/yyyy (the preferred format; if possible would like to keep this).

    Going into the backend, I'm trying to code the php for get today's date and the query meta comparison. Here is the code I have:

    <?php  //Get today's date in the right format
    $todaysDate = date('m/d/Y');
    ?>
    
    <?php query_posts('showposts=-1&category_name=Event&meta_key=StartDate&meta_compare=>=&meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC'); ?>

    This is not currently working and I can't figure out what I'm doing wrong. Just to reemphasize, I am only trying to post events that have not yet occurred, hence why I need to make the comparison.

    If I've made anything unclear let me know and I will clarify as soon as possible. And thank you in advance for any feedback.

    http://wordpress.org/extend/plugins/custom-field-template/

  2. zstoy
    Member
    Posted 6 months ago #

    I'm having the exact same issue. The funny thing is that upcoming events are showing only for events this year. As soon as I post an event next year they are not showing.

    It must be something in the call of the $todayDate... Do you think we can call that in a different format?
    Anyone else have any ideas?

  3. Ericka125
    Member
    Posted 6 months ago #

    Still needing help with this. Anyone have any thoughts on how to fix this?

Reply

You must log in to post.

About this Plugin

About this Topic