Home › Forums › Calendar Products › Events Calendar PRO › Problems with tribe_get_events
- This topic has 18 replies, 3 voices, and was last updated 13 years, 10 months ago by
Rob.
-
AuthorPosts
-
June 10, 2012 at 4:18 pm #20443
Bob
ParticipantI 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)
June 11, 2012 at 8:15 am #20470Jonah
ParticipantHi 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,
JonahJune 11, 2012 at 6:02 pm #20508Bob
ParticipantDuh. 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.)
June 11, 2012 at 6:04 pm #20509Bob
ParticipantSorry, lost the text due to formatting. I had to use the <? syntax and tribe_get_event_link($post)
June 11, 2012 at 6:04 pm #20510Bob
ParticipantOne more time <?=
June 11, 2012 at 6:08 pm #20512Rob
MemberHey Bob: it may help for limited code snippets (and I mean real limited) to use < code >…
June 11, 2012 at 6:19 pm #20517Bob
ParticipantOk, 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.
June 11, 2012 at 7:01 pm #20533Rob
MemberYup 🙂 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.
June 12, 2012 at 5:13 am #20553Bob
ParticipantHmmm… 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.)
June 12, 2012 at 6:51 pm #20596Jonah
ParticipantHi 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,
JonahJune 12, 2012 at 7:37 pm #20604Bob
ParticipantSo 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.
June 13, 2012 at 3:49 pm #20634Jonah
ParticipantHey 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,
JonahJune 13, 2012 at 8:19 pm #20653Bob
ParticipantSigh. 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.
June 14, 2012 at 8:46 am #20669Jonah
ParticipantBummer, 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,
JonahJune 20, 2012 at 8:27 pm #20933Bob
ParticipantSorry, 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.
-
AuthorPosts
- The topic ‘Problems with tribe_get_events’ is closed to new replies.
