Help Desk

tribe_get_events template tag

  • Posts: 3 Topics: 5
    | Permalink

    is it possible to get an example of this function:
    with all the args filled in? Just to know the exact syntax for querying events?

    Posts: 3 Topics: 5
    | Permalink

    never mind, got it sorted, but one thing, is there any way to filter events by recurring/ non recurring?

    Posts: 4278 Topics: 105 Answers: 467
    | Permalink

    Hey 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.

    Posts: 31 Topics: 9
    | Permalink

    Hey Kevin, can you post your code?

    Posts: 3 Topics: 5
    | Permalink

    Hi slny311

    I found out that tribe_get_posts() is a wrapper around wordpress’ get_posts() function, so you can see all the parameters here:

    it 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!

    Posts: 31 Topics: 9
    | Permalink

    Hey 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…

    Posts: 3 Topics: 5
    | Permalink

    Hi 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!

    Posts: 31 Topics: 9
    | Permalink

    thanks kevin… lol.