Problems with tribe_get_events

Home Forums Calendar Products Events Calendar PRO Problems with tribe_get_events

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #20443
    Bob
    Participant

    I have the following code in a page template, pulled almost exactly from one of the examples in the documentation:

    global $post;
    $current_date = date(‘j M Y’);
    $end_date = date(‘j M Y’, strtotime(‘+1 week’));

    $all_events = tribe_get_events(
    array(
    ‘eventDisplay’ => ‘upcoming’,
    ‘start_date’ => $current_date,
    ‘end_date ‘=> $end_date,
    ‘posts_per_page’ => 5,
    ‘tax_query’=> array(
    array(
    ‘taxonomy’ => ‘tribe_events_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => $blog_cat
    )
    )
    )
    );

    foreach($all_events as $post) {
    setup_postdata($post);
    ?>

    <h3 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    <div style="margin-bottom: 1em">
    <span class="event-date"><a href="<?php the_permalink(); ?>"><?php echo tribe_get_start_date($post->ID, true, ‘M j, Y’); ?></a></span>

    <?php if ( has_post_thumbnail() ) { ?>

    <div class="event-thumb">
    <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(‘thumbnail’); ?></a>
    </div>
    <div class="event-excerpt">
    <?php the_excerpt(); ?>
    </div>

    <?php } else { ?>

    <div class="event-content">
    <?php the_content(); ?>
    </div>

    <?php } ?>
    </div>

    <?php } ?>
    <?php wp_reset_query(); ?>

    I’ve got multiple things not working, though:
    1. The ‘eventDisplay’ parameter does nothing. Results are identical with or without it.
    2. The start_date and end_date seem to do nothing either. At least the end_date doesn’t. posts_per_page number of posts are shown no matter what, even though they go past the end_date
    3. For our recurring events, the_permalink is linked to 1970-01-01, which is a 404. It should link to the specific upcoming event instance.

    (Note also that we still haven’t been prompted to update to PRO 2.0.7 despite having updated to Free 2.0.7. See comments at https://theeventscalendar.com/support/forums/topic/release-the-events-calendarpro-2-0-7)

    #20470
    Jonah
    Participant

    Hi Bob,

    We don’t have very good code pasting capabilities here so would you please post your code to Pastebin, Pastie or Gist? It will make it much more readable for me. Also, make sure your single quotes are actually that and not apostrophes. I think instead of the_permalink() we should be using tribe_get_event_link() which I’ll update in the doco right away…

    Thanks,
    Jonah

    #20508
    Bob
    Participant

    Duh. Pastebin, shoulda thought of that. http://pastebin.com/nZHghqvh

    But I think I eventually got the link I wanted by replacing the_permalink() with

    (With the <?php syntax the docs showed, nothing was output.)

    #20509
    Bob
    Participant

    Sorry, lost the text due to formatting. I had to use the <? syntax and tribe_get_event_link($post)

    #20510
    Bob
    Participant

    One more time <?=

    #20512
    Rob
    Member

    Hey Bob: it may help for limited code snippets (and I mean real limited) to use < code >…

    #20517
    Bob
    Participant

    Ok, good to know.

    But… that leaves the other 2 issues remaining: eventDisplay seems to do nothing and start_date/end_date don’t seem to work.

    #20533
    Rob
    Member

    Yup 🙂 Jonah’s probably off for the day by now but I’ve thrown this back into his pile so we can hopefully get this resolved for you tomorrow. Thanks for your patience so far.

    #20553
    Bob
    Participant

    Hmmm… another glitch too with that code. It’s showing 5 upcoming events from the particular category, but it’s skipping one that it should be showing. If I look at the calendar by category, I see event 1, 2, 3, 4, 5, 6, but the query is showing 1, 2, 3, 4, 6, having omitted 5. All are weekly recurring events in this case.

    (Also, we’re now on 2.0.7 after a manual install.)

    #20596
    Jonah
    Participant

    Hi Bob,

    I’m going to need some more specifics from you like examples of which events on the calendar should be showing in the query and the ability to look at the results of your query and please post updated code if you’ve updated that.

    Thanks,
    Jonah

    #20604
    Bob
    Participant

    So here’s the updated code, but I think it’s just that one call changed: http://pastebin.com/ZUcJpsGi

    Not sure what else to provide. You can see the calendar itself, for one specific category that has the problem, at:
    http://www.trinityfellowship.net/events/category/smallgroups/

    Then see the page which has the linked code at:
    http://www.trinityfellowship.net/small-groups/

    And see that the list of events skips one that is there on the calendar on the 18th but shows the one after it on the 19th.

    I have no idea how to demonstrate that the evenDisplay parameter seems to nothing at all, but I guess I don’t really care if I don’t need it.

    For the start & end date, if I echo the end_date, it is what I expect (20 June right now), but if I omit the posts_per_page, I get events way past that end date.

    #20634
    Jonah
    Participant

    Hey Bob,

    It took me a while to see this… but you’ve got a space after the ‘end_date’ parameter that’s throwing the query off. Fix that and let me know if you still have issues with the query.

    Thanks,
    Jonah

    #20653
    Bob
    Participant

    Sigh. Yeah, missed that too. That definitely fixed the original problem #2. Still missing the event on the 18th while including the one on the 19th, though.

    #20669
    Jonah
    Participant

    Bummer, can you provide me WP admin access so I can dig into this a little deeper. I don’t need to change anything I just want to try and figure out why that one event is not showing up in the query… Please email to pro [at] tri.be and reference this thread.

    Thanks,
    Jonah

    #20933
    Bob
    Participant

    Sorry, trying to decide whether I can to give somebody outside such access. Have to get agreement from the rest of the folks. Definitely want to resolve it, but contemplating even trying deleting and recreating the recurring event.

Viewing 15 posts - 1 through 15 (of 19 total)
  • The topic ‘Problems with tribe_get_events’ is closed to new replies.