“Events list” HELP in WP custom theme for client ..
# May 20, 2013 at 10:42 pm
ok so i am having a problem trying to get my events to only display if the date has not already passed. meaning pretty much if the date is anything less then today dont show it. Ive been wrastling with this for a few hours now and i am in much need of help. ive tried all diff kinds of things.
i am using wordpress and i am also using the custom post types plugin and custom post types ui plugin.
the custom field i am trying to grab the date from and use to compare is called “date_of_event” and it is being created with the datepicker.
if you want to see a live version of what i have now it is indeed live on my server and its working as far as grabing the custom post type and displaying the date chosen by the date picker in the correct ASC order n stuff but for dates that have passed they are still showing as i have not written any logic to do so. this is what im having trouble with. this is the link –> [http://domenicocolandrea.com/tiki-bar/
also if you want to see what my code looks like a link to a .php file of the exact page is here –> [https://www.dropbox.com/s/64zjakrkgtai1mn/eventsHELP.php](https://www.dropbox.com/s/64zjakrkgtai1mn/eventsHELP.php “eventsHELP.php”)
To anyone that responds i thank you ahead of time. if there is anything else you may need of me to provide in order to better tackle this please let me know and i will do so.
Dominick# May 22, 2013 at 5:16 pm
This reply has been reported for inappropriate content.
1 ) Create a variable to store the current date/time
2) Make sure the format for the current date and the event date are the same.
I’m assuming you’re using Advanced Custom Fields for the date picker field. Dates are extra picky about format.
3) Wrap the event-slot div creation part of the loop in a conditional that compares the two dates
You must be logged in to reply to this topic.