Using multiple categories in EventCalendar3 for WordPress

By | June 11, 2006

So I read at a few points that EventCalendar 3.1 was on its way, but I decided to start mangling some code to get multiple event categories to work!

Open eventcalendar3.php near line 525;

// Which posts are we interested in?
// Category ID number for event posts.
$where_post = "category_id IN ('$ec3->event_category','14')";

I changed $where_post to add another category, this category will show up in the calendar now!

Also update line 540 to incorperate the same code so the date will be colored!

$calendar_entries = $wpdb->get_results(
DAYOFMONTH(post_date) AS day,
MONTH(post_date) AS month,
YEAR(post_date) AS year,
(category_id IN ('$ec3->event_category','14')) AS is_event
FROM $tableposts,$tablepost2cat
WHERE post_date >= '$begin_date'
AND post_date <  '$end_date'
AND post_status = 'publish'
AND id = post_id
AND $where_post
ORDER BY post_date ASC"

Each of my Event categories I want to add will be entirely seperate categories, no sub-categories, I did this so I could exclude some categories from showing up where I did not want them.

To add each category to show up like the events open eventcalendar3.php again near line 1032;

$ec3->is_listing =
(preg_match("/\bcategory_id\s*=\s*'?($ec3->event_category|3|4|14|8|9)'?\b/",$where) ||

I changed preg_match("/\bcategory_id\s*=\s*'?$ec3->event_category'?\b/",$where) || to add the extra categories.

Each category I want to show up in the calendar view I make sure that they are part of the Event category as well as their own.

You can see this in effect at

2 thoughts on “Using multiple categories in EventCalendar3 for WordPress

  1. Jeff

    I seem to have completely different code in my version of EC3. Different variable names and different lines. I can’t quite make the translation.

  2. Barrett Sonntag Post author

    Jeff, it has been 3 years since I messed with EC3, it is likely that the code base has changed completely. I wish you luck.

Leave a Reply

Your email address will not be published.

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.