Event Organiser
[resolved] Somewhere in 1.5.x the archive-events.php template stopped working (12 posts)

  1. John Sundberg
    Posted 2 years ago #

    Not sure why I didn't notice this sooner, but I'm running three sites with Event Organiser, and I've recently updated each of those to either 1.5.4 or 1.5.5. I also updated to WordPress 3.4.2 but I don't think that's a factor here, though I could be wrong...

    On each of those three sites the Events page that is using archive-event.php (my modified version) as a page template is no longer displaying any events. What it is displaying is the word "Events" as a link to nowhere, "Date:" and "Time" empty, and a link to "Event Details" that also goes nowhere.

    In 1.4.2 the events were displayed correctly and pagination worked well.

    I've been working on one of the sites and have integrated a new WP_Query into the loop, and now the events are displaying, but pagination isn't working. I've been working on the pagination for a few hours now with no results.

    Here's the query code I added:

    <?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; ?>
    <?php $event_archive_query = new WP_Query( 'post_type=event&posts_per_page=2&paged='.$paged ); ?>

    and my loop looks like:

    <?php if ( $event_archive_query->have_posts() ) : while ( $event_archive_query->have_posts() ) : $event_archive_query->the_post(); ?>

    So what I'm wondering is, did something happen from 1.4.2 to 1.5.x that broke archive-event.php, and now that I'm using WP_Query, what will I need to change or do to get pagination working in the event archive?



  2. John Sundberg
    Posted 2 years ago #

    Oddly enough, the taxonomy templates still seem to be working in 1.5.x, and single events are displaying correctly.

  3. John Sundberg
    Posted 2 years ago #

    I just updated one of my development sites to WordPress 3.4.2. The site still has Event Organiser 1.4.2 installed, and events are displaying like they should.

  4. keesiemeijer
    Posted 2 years ago #

    Is the pagination working also? I never used the plugin but there is no need for a new WP_Query in your post type archive archive-event.php to have posts show up from that post type.


  5. John Sundberg
    Posted 2 years ago #


    After I thought about this overnight, it didn't make sense that archive-event.php wouldn't be working, so I thought the issue was somewhere in the custom post type code, and this is what I found:

    In version 1.5.x, line 177 of includes/event-organiser-cpt.php you had changed

    'has_archive' => true,


    'has_archive' => $events_slug,

    I changed that back to true, uploaded the modified file, refreshed the permalinks, and we're back in business.


  6. John Sundberg
    Posted 2 years ago #

    Marking as resolved...

  7. John Sundberg
    Posted 2 years ago #

    And I just realized that archive-events.php in the title of this thread should have been archive-event.php

  8. Stephen Harris
    Plugin Author

    Posted 2 years ago #

    Hi John - this was added so that the archive page could have a different permlalink structure from the single event page. If you undo your changes, save the plug-in settings and flush the permalink - does this also resolve the issue? I will test it on a test site, but I suspect that the $events_slug doesn't contain the default events/event string?

    Also, instead of using a WP_Query you might want to use the pre_get_posts hook?

  9. John Sundberg
    Posted 2 years ago #

    Hey Stephen,

    I'll try that on a test site, hopefully today yet.

    When the events started showing up again I did away with the WP_Query approach and reverted back to using your archive-event.php file as a template for my own.

    My Event Settings > Permalinks settings for all three sites look like this:

    Enable (yes)
    Event (single): events
    Event (archive): events/event
    Venues: events/venues
    Event Categories: events/category
    Event Tags: events/tag

    Though I don't quite understand what's happening with Event (archive) there, since on each site the events archive page just has "events/" in the URL? (Maybe that's what you were getting at with your question?)

    I'll let you know how the testing goes.

  10. John Sundberg
    Posted 2 years ago #

    This seems to work with includes/event-organiser-cpt.php restored back to using the variable instead of 'true':

    Event (single): event
    Event (archive): events

    I need to head out for a while, but I'll do some more testing when I get back...

  11. John Sundberg
    Posted 2 years ago #

    And finally, in the end it seems that the permalink settings that I had for Event Organiser were not compatible with the addition of $events_slug, and all I really needed to do was make a simple edit to the permalinks. Here's what I finally went with:

    Event (single): events
    Event (archive): events

    Everything is back to normal. :)

    Now, on to the next issue that isn't really an issue...

  12. John Sundberg
    Posted 2 years ago #

    Stephen, by the way, thanks for taking the time to produce and maintain Event Organiser. I've tried a couple others, and even though this one isn't exactly plug and play, the end result is worth the time involved in integrating it into my sites.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Event Organiser
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic