problem with tribe_get_events(); showing repeated start date

Home Forums Calendar Products Events Calendar PRO problem with tribe_get_events(); showing repeated start date

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #111668
    sunvalleycenter
    Participant

    page is http://sunvalleycenter.org/education-humanities/classes-workshops
    Using this query:
    $show_events_category = get_post_meta($post->ID, get_theme_prefix() . ‘show_events_category’, true);
    $eventDisplay = isset($_GET[‘pastEvents’]) ? ‘past’ : ‘upcoming’;
    $posts = tribe_get_events(
    array(
    “post_type” => “tribe_events”,
    ‘eventDisplay’ => $eventDisplay,
    ‘tax_query’=> array(
    array(
    ‘taxonomy’ => ‘tribe_events_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => $show_events_category
    )
    ),
    “numberposts” => -1
    )
    );
    The event date always shows the start date, not the sequential dates of the event so event is repeated many time with same date.
    <?php if (!tribe_get_all_day()):?>
    <h3><?php echo date(‘l, F j, g:i a’, strtotime(tribe_get_start_date())); ?></h3>
    <?php else :?>
    <h3><?php echo date(‘l, F j’, strtotime(tribe_get_start_date())); ?></h3>
    <?php endif; ?>
    What do I need to do to get proper dates to show?

    #111913
    Barry
    Member

    Hi – unfortunately the forum doesn’t do a great job when it comes to sharing code.

    Can I ask you to share that code via a Pastebin link or via some similar service? It looks like you may not be looping through the query results which might partly explain this, but I’m not sure if that may simply be because code has been stripped out by the forum.

    Let us know!

    #112328
    sunvalleycenter
    Participant

    Thanks so much for looking – here is pastebin link: http://pastebin.com/XPGtvRTD
    and page with issue is http://sunvalleycenter.org/education-humanities/classes-workshops
    You can see that class such as “1st-3rd Grade Spring Break Art Camp with Danica Robrahn” is repeated several times with the same date rather than progressive dates for the event.
    THANKS AGAIN!

    #112424
    Barry
    Member

    Are those affected events recurring events, do you know? Generally speaking it is best to setup the post data as documented in the Codex rather than directly retrieving items from the array in the query result – certainly if you are using recurring events this is a good idea as otherwise (at this time) it is difficult for The Events Calendar/Events Calendar PRO to distinguish between instances of an event, since they all share a common post ID.

    Is there a reason why you can’t use (and customize) the default upcoming event list?

    #112428
    Barry
    Member

    (Slightly off topic, but I just wanted to say that is a fantastic looking site and some impressive work that you’ve done so far in customizing the calendar output.)

    #113055
    sunvalleycenter
    Participant

    Yes recurring events. I wish I could take more credit but am picking up this site from past developers. There is a page where events/list.php is used and the events then show correctly. http://sunvalleycenter.org/events-calendar/upcoming
    That is basically the exact same content as this page I am trying to fix and I assumed there was some reason why that could not be used in this case instead of page.php. So you are saying use the same loop as in events/list.php instead. Is there some setup I need to do before the loop?

    #113108
    Barry
    Member

    It looked (and I could have easily been mistkaen 😉 ) like you were building a sort of replacement list view, I just wondered if you could use the existing list view and customize from there. In terms of setting the loop up, the WP Codex shows how you can pull posts in a more conventional style. I’m afraid though since this is really the domain of custom development we can’t offer too much more help with this.

    #113146
    snorton
    Participant

    @sunvalleycenter , I had a similar situation where I wanted to build a custom list view. This will need to be modified to fit your needs, but outputs recurring event dates correctly without repeating the initial event date:
    http://pastebin.com/NzGyFxEz

    #113343
    sunvalleycenter
    Participant

    Thanks for all the help – I’ll take it from here and will post back if I run into any specific questions but now I have a GREAT starting point.

    #138301
    Barry
    Member

    Closing this thread as it’s been quite a while – of course if we can help with anything else please do create a new thread. Thanks!

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘problem with tribe_get_events(); showing repeated start date’ is closed to new replies.