Annual Archives?

Home Forums Calendar Products Events Calendar PRO Annual Archives?

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #18440
    Marty
    Participant

    Hi there,

    I need to create list-style views for given years. Right now the direction I’m considering is creating page templates that execute a specially constructed query. But that seems like a very manual approach and I sense there’s a better way.

    For instance, I’d rather do hook into the existing ECP infrastructure, for instance by adding a new parameter:

    /events/2011

    Which could also apply to categories:

    /events/category/free-events/2011/

    Any tips on how to approach this? Anything that can get me pointed in the right direction would be appreciated. Thanks!

    #18450
    Jonah
    Participant

    Hey Marty,

    Good question. I don’t think this is easily achievable with the plugins infrastructure so you’d probably be better off creating the page templates. That’s what I would do if I was building a site that need this. You can easily setup custom queries using WP_Query or tribe_get_events() (https://theeventscalendar.com/support/documentation/the-events-calendar-template-tags-general-functions/#functiontribe_get_events)

    It’s not a bad idea though and it might be a good feature in the future. If you’re interested you can add it to out feature request thread here: https://theeventscalendar.com/support/forums/topic/events-calendar-pro-feature-requests/

    I hope that helps!

    #18577
    Marty
    Participant

    Hi Jonah, thanks for the response. Can you tell me a bit more about tribe_get_events()? I’m trying this:


    'eventDisplay'=>'past',
    'start_date'=> '1 Jan 2004',
    'end_date'=> '31 Jan 2004',
    'posts_per_page'=>-1

    But it’s including events all the way up to yesterday. I take it end_date’s not what I need in this case? What’s the correct way to limit a query to events beginning within a certain date range?

    Thanks

    #18584
    Jonah
    Participant

    Hey Marty,

    Try passing in the date in this format instead ‘1/1/2004’ – that should work.

    #18700
    Marty
    Participant

    Hi Jonah,

    Sorry, that didn’t work for me. I was able to do it (so far so good, at least) using WP_Query with meta_query:

    $thisyear = get_post_meta($post->ID, 'year', true);
    $nextyear = $thisyear + 1;

    $args = array(
    'post_type' => 'tribe_events',
    'posts_per_page' => -1,
    'orderby' => 'meta_value',
    'meta_key' => '_EventStartDate',
    'meta_query' => array(
    array('key' => '_EventStartDate',
    'value' => array($thisyear . '-01-01 00:00:00', $nextyear . '-01-01 00:00:00'),
    'type' => 'DATETIME',
    'compare' => 'BETWEEN'
    ))

    );

    $the_query = new WP_Query( $args );

    #18712
    Jonah
    Participant

    Hmmm, ok try this format: ‘2012-05-03 00:00:00’

    Glad you got it working though 🙂

    #19480
    Marty
    Participant

    Hi. I’ve got the page-based solution working and was moving on… and then I came upon this:
    http://snipplr.com/view.php?codeview&id=17432

    It creates year based archives for categories. Which is awesome. It doesn’t automagically work for Events, but might it point the way to something that could work?

    Anyone out there fluent in wp_rewrite who could offer an opinion?

    #19490
    Debra
    Participant

    Marty: I need to do the exact same thing – have a page for year based archives. Do you mind sharing your page based solution code?
    Thanks!

    #19547
    Rob
    Member

    Marty: mind sharing your solution for the above, so Debra can take advantage of it?

    As for the wp_rewrite…I’m not familiar with this myself but I’ll ask the team and if one on our end has an idea here they’ll comment directly.

    #19583
    Debra
    Participant

    I was able to accomplish what I needed (listing the events by year) by creating a category for each year and then linking to that category listing page. Worked well without any special coding.

    I’d still like to see Marty’s solution though in case my client needs anything more involved.

    #19609
    Rob
    Member

    Awesome to hear you found a solution here, Debra. If Marty sees this hopefully he can share what his was as well (so you’ve got multiple options available).

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Annual Archives?’ is closed to new replies.