Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #26745

    On the homepage here: http://www.thecentersf.com/test/

    I have a column listing for upcoming events of category ‘featured’

    and a column for events that are happening today.

    The problem is I am seeing events under today that are happening 2 days in the future

    Here is the code I am using to query those events in helper-template-dynamic.php

    function columns_helper_today_entries($data)

    {

    $data = ‘avia_add_event_range';

    $data = true;

    $data = TribeEvents::POSTTYPE;

    $current_date = date(‘j M Y’,strtotime(‘1 day’));

    $data = array(‘start_date’=>$current_date,’end_date’=>$current_date);

    return $this->columns_helper_latest_entries($data);

    }

    #131466

    Did you try

    $current_date = date('j M Y');
    $end_date = date('j M Y', strtotime('now'));

    or

    $current_date = date('j M Y');
    $end_date = date('j M Y', strtotime('+1 day'));

    - do you notice any changes? Some other examples can be found here: http://tri.be/support/documentation/the-events-calendar-template-tags-general-functions/#functiontribe_get_events

    #131467

    well, i tried all the permutations i could think of with now, +1, or nothing and I either receive results for 2 days from now, or no results.

    not sure what’s up or what to try…

    i would post on the tribe forum if i could but it’s for licensed members only

    #131468

    Maybe the query itself doesn’t work. Did you try to insert the sample code:

    global $post;
    $current_date = date('j M Y');
    $end_date = date('j M Y', strtotime('1 day'));

    $get_posts = tribe_get_events(array('start_date'=>$current_date,'end_date'=>$end_date,'posts_per_page'=>10) );

    somewhere? Do you get the same results if you call the tribe_get_events() function directly without using $data?

    Btw the devs sometimes help users for free in the official wp.org forum: http://wordpress.org/support/plugin/the-events-calendar

    #131469

    Thanks for the suggestions

    After doing a more testing and research I figured it out.

    For some reason it only provides the correct results when i query events between yesterday and today. That seems odd…

    Also I needed to set eventDisplay to all for some reason

    Here is the code that seems to work currently:

    $today = date(‘j M Y’);

    $yesterday = date(‘j M Y’,strtotime(‘-1 day’));

    $data = array(‘start_date’=>$yesterday,’end_date’=>$today,’eventDisplay’=>’all’);

    return $this->columns_helper_latest_entries($data);

    #131470

    Hi!

    Glad you found a solution :)

    Best regards,

    Peter

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

The topic ‘Query today's events only’ is closed to new replies.