WP_Quqery get event by year

Home Forums Calendar Products Events Calendar PRO WP_Quqery get event by year

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #145299
    unikmedia
    Participant

    Ho can i get all the events in a specified year?

    $evenements = new WP_Query(array(
    ‘post_type’ => ‘tribe_events’,
    ‘posts_per_page’ => ‘-1’,
    ‘orderby’ => ‘menu_order’,
    ‘order’ => ‘ASC’,
    ‘post_status’ => array(‘publish’, ‘pending’, ‘draft’, ‘auto-draft’, ‘future’, ‘private’, ‘inherit’, ‘trash’),
    ‘tribe_events_cat’ => $category,
    ‘eventDisplay’ => ‘all’
    ));

    What is the attribute i must use?

    #145833
    Casey D
    Member

    Hello unikmedia,

    Thanks for contacting us! I believe this gist will point you in the right direction:

    https://gist.github.com/jo-snips/5112025

    I assume because you are writing your own WP_Query you don’t need much help, but let me know if I can give you any pointers.

    One of our devs recommends tribe_get_events() over a straight WP_Query. Set eventDisplay to custom and start_date and end_date appropriately to mark the year using Y-m-d (or yyyy-mm-dd)

    http://docs.tri.be/Events-Calendar/source-function-tribe_get_events.html#154-170
    http://docs.tri.be/Events-Calendar/source-class-TribeEventsQuery.html#785-832

    Does this make sense? Let me know if I can explain anything else!

    Cheers!

    – Casey Driscoll

    #161298
    Casey D
    Member

    Hello unikmedia,

    We typically close threads if there is no activity after two weeks. Feel free to create a new thread and reference this one to save you time.

    Cheers!

    – Casey Driscoll

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘WP_Quqery get event by year’ is closed to new replies.