Home › Forums › Calendar Products › Events Calendar PRO › tribe_get_events template tag
- This topic has 7 replies, 3 voices, and was last updated 12 years, 6 months ago by slny311.
-
AuthorPosts
-
October 25, 2011 at 11:05 am #10119KevinMember
is it possible to get an example of this function:
tribe_get_events
with all the args filled in? Just to know the exact syntax for querying events?October 25, 2011 at 11:56 am #10121KevinMembernever mind, got it sorted, but one thing, is there any way to filter events by recurring/ non recurring?
October 26, 2011 at 4:51 pm #10214RobMemberHey Kevin. Glad to see you got the first issue resolved. There’s no way to do that on the frontend, unfortunately…you can separate between the two on the backend but nothing along those lines on the public-facing side. You could possibly hack something like that together, but I’m afraid I can’t offer up more than that.
October 28, 2011 at 11:46 am #10303slny311ParticipantHey Kevin, can you post your code?
October 28, 2011 at 12:39 pm #10312KevinMemberHi slny311
I found out that tribe_get_posts() is a wrapper around wordpress’ get_posts() function, so you can see all the parameters here:
http://codex.wordpress.org/Template_Tags/get_posts
http://codex.wordpress.org/Function_Reference/get_postit adds the post_type of tribe_events and sorted by ascending date by default.
on a second note, to filter repeating events ( I was only after weekly events) I added this to my parameters in the query:
‘post_name’ => ‘weekly-events’I hope that helps!
October 28, 2011 at 12:55 pm #10313slny311ParticipantHey Kevin thank for the reply, im new and still learning wp
i am trying to change the featured widget to show only todays events…
so in the widget-featured.class.php file i replaced
$posts = tribe_get_events( ‘numResults=1&eventCat=’ . $category);
with below and its not showing anything…
$today = getdate();
$query = new WP_Query( ‘year=’ . $today[“year”] . ‘&monthnum=’ . $today[“mon”] . ‘&day=’ . $today[“mday”] );
$posts = tribe_get_events( ‘numResults=1&eventCat=’ . $category . $today);
Any thoughts would be appreciated…
October 28, 2011 at 1:24 pm #10314KevinMemberHi slny311,
in your tribe_get_events query you are trying to concatenate a date with a category which won’t work.
get_posts does not have a ‘date’ parameter so your not going to be able to use that.Just of the top of my head I would get today’s date, and then run a conditional to see if the date of the post is equal to today’s date and if so, then display the post.
something like if (the_date() == $today) {
do this….
}you’ll have to google around to see how to write this correctly.
Hope that helps!
October 28, 2011 at 1:30 pm #10315slny311Participantthanks kevin… lol.
-
AuthorPosts
- The topic ‘tribe_get_events template tag’ is closed to new replies.