• Hi!

    I don’t know if this have been posted before, but I have been searching google, and this forum for days now and I haven’t found the code I need.

    I have a wordpress website, showing events for a nightclub. So every post is a event. The events have a custom field where the event date is set with swedish formatting (YYYY-MM-DD). The date of the event is displayed at another page and I want it to be easy for the owner of the night club to admin the website.

    I would like to, at the index page of my website, show the two next comming events, sorted by the custom field date. And when a event is happening today, the event will be the first one (of two) displayed at the index page. The nightclub is closing at 02.00 (2pm) and I would like that event to show the whole day the event is happening, and then dissapear from the index page at 04:00 (4pm). Thats 04:00 (4pm) the day after the event has been happening.

    After this function, when the page has been hiding the post which has been happening, the index will display the next two events happening, sorted by the custom field date.

    So…. My problem is:

    How to hide posts when they are “out of date” according to the custom field date???

    And I don’t want to sort and hide the posts according to the date the event/post was created, because the night club owner isn’t creating the posts/events in the right date order. And another excuse for not displaying the events/posts after the post date is that I’m displaying the event dates (from the custom field) at another page on the website.

    Have you got enough information to help me? Can someone help me out? Is exactly this done before? Where?

    I really appreciate your help! I have been trying to fix this for a week now.

    /Daniel, Sweden

    EDIT:
    I don’t feel like using a plugin since i feel like I wanna “know whats happening in the code”. AND I would like to NOT specify in the custom field what time the event should be hided on, I should ALWAYS be hided at 04:00 (4pm) the day after the event. AND I would like to have this time formatting in the custom field: YYYY-MM-DD

  • The topic ‘Hide post after custom field date’ is closed to new replies.