'If' statement for past events

This topic contains 2 replies, has 2 voices, and was last updated by  Stephen Harris 9 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #15768

    I’m trying to add in a way for people to submit photos to a past event. I’m using a plugin that lets them upload images to a cpt, and the only part I can’t figure out is how to make it so that the uploader doesn’t show until after the event takes place.

    I’m assuming I can use eo_get_the_end(‘jS M YY’); within an if statement, but i’m not sure how to set that up to compare it to the current date. Or is there another code I should be using instead of the get_the_end?

    Aaron Robb
    #15769

    Found a solution!
    Of course, it happens after i post this question. Here’s how it works:

        <?php
     $date = eo_get_the_end('Ymd');  // event end date
        $today = current_time('Ymd');// getm today's date
        if ( $date <= $today ) {
        ....do stuff...
        } else {
    } ?>
    
    Aaron Robb
    #15774

    That will work (but I prefer to use DateTime objects)

    Please note that if this a recurring event you will want to use eo_get_schedule_last()http://codex.wp-event-organiser.com/function-eo_get_schedule_last.html – this will give you the start date of the last occurrence.

    Stephen Harris
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.