Events+ Custom Theme for Categories

I'm trying to setup a custom theme template for a category archive of events. Paul has been helping me on chat this morning, archived here: https://premium.wpmudev.org/live-support-plugins-and-code/?cid=591 .

So far, we've gotten to the point where the template file is working for normal archive pages (http://ecrp.pottervilla.com/events/2012/07/), but not for the category pages (http://ecrp.pottervilla.com/events/upcoming/)

I have two files newly added to my theme, archive-incsub_events.php and single-incsub_events.php. (The CSS is taken care of). However, the category page is still being handled by index.php.

We've been referencing this file: http://codex.wordpress.org/images/1/18/Template_Hierarchy.png . However, category-upcoming.php doesn't load either.

So, I'm still hunting. If anyone has ideas, I'd be happy to hear them! Otherwise, I'll keep my progress updated here.

- Jonathan

  • Jonathan Potter
    • Site Builder, Child of Zeus

    However, taxonomy.php does invoke the code snippet we put in the custom file. So /events/category is actually loaded as a taxonomy term. Odd.

    I'll definitely post my findings, thoward. It's too bad that there is no theming information in the setup instructions.

  • Jonathan Potter
    • Site Builder, Child of Zeus

    After about four hours of research, troubleshooting, and trial and error, I've tracked down one of the deeper root issues with category pages in this plugin.

    As discovered above, the category archive pages are actually handled as taxonomy archives, not category ones. As I was working with the CSS, and noting various discrepancies, it turned out that several of the plugin's CSS files weren't getting loaded on those pages. I did a compare between the taxonomy archive and the regular archive, and noticed that a few javascript scripts were also missing.

    That knowledge let me on a merry chase to lines 799 and 820 of events-and-bookings.php, where I found this IF construct (in both places): if (isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'incsub_event'){

    The first IF construct contains the wp_enqueue_style() function for front.css, and the second contains wp_enqueue_script() for eab-event.js and eab-api.js (among other code).

    But when the taxonomy archive page doesn't register the correct page_type, it ignores these includes. So, I modified the query to: if ((isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'incsub_event') || (isset($wp_query->query_vars['taxonomy']) && $wp_query->query_vars['taxonomy'] == 'eab_events_category')){

    And violà, I now am loading the CSS & Javascript on my taxonomy category pages.

    I don't think this is the ideal way to check for Events+ content on a page, because it seems like it would be hard to be exhaustive. And I think there may be a deeper issue with event category pages being listed as taxonomy in the first place. But I'm more of a code hacker than developer at this point in my life. It would be interesting to see if VeBailovity has any comments on the issue--I'm sure I've done something horrible to his actually pretty nice code at some point today. :smiley:

    I think that resolved the issue--hopefully. I'll let you know!

    - Jonathan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.