jump to navigation

WP Plugin tweak : Events Calendar – EventsListLarge

Here are additions for ec_calendar.class.php, events-calendar.php, and css/events-calendar.css files to add an EventsListLarge capability analagous to the EventsCalendarLarge tag.

* Displays the Event List in large format
function displayEventLargeList($num) {
global $current_user;
$db = new EC_DB();
$js = new EC_JS();
$options = get_option('optionsEventsCalendar');
$format = $options['dateFormatLarge'];
$events = $db->getUpcomingEvents($num);
echo "<div id=\"wp-listLarge\"><h2>Upcoming Events</h2><br />";
echo "<ul>";
foreach($events as $event) {
if($event->accessLevel == 'public' || $current_user->has_cap($event->accessLevel)) {
$splitDate = explode("-", $event->eventStartDate);
$month = $splitDate[1];
$day = $splitDate[2];
$year = $splitDate[0];
$startDate = date("$format", mktime(0, 0, 0, $month, $day, $year));
$splitTime = explode(":", $event->eventStartTime);

$startTime = date(“g:i A”, mktime($splitTime[0], $splitTime[1]));

//$startDate = $startDate < date(“$format”) ? date(“$format”) : $startDate;
echo “<li id=\”events-calendar-list-$event->id\”><b>$startDate</b>: ” . stripslashes($event->eventTitle) . ” – $startTime</li>”
echo “</ul></div>”;

function filterEventsListLarge($content) {
if(preg_match("[EventsListLarge]",$content)) {
$calendar = new EC_Calendar();
$content = str_replace("[[EventsListLarge]]", $calendar->displayEventLargeList(10), $content);
return $content;

add_filter(‘the_content’, ‘filterEventsListLarge’);

* Large List formatting
#wp-listLarge {
border: thin solid black;
padding: 5px;
vertical-align: top;

#wp-listLarge ul {
list-style: none;

#wp-listLarge ul li {
padding: 5px;
vertical-align: top;
text-align: left;
font-size: large;

#wp-listLarge ul li:hover {


1. Aidan - June 21, 2008

I haven’t tried this yet but if it works it will be great. I’ve been looking for a WP events plugin that can show events in list form. I’ve tried some but they all appear to be really basic and do not have a nice interface for entering events like the EC calendar has. The month calendar view is nice in some cases but for most cases of showing evnts a list format is much more practical – when the events are spread out over many months.

2. Jason - July 29, 2008

I would love to have this functionality but I can’t seem to get it to work. Can you clarify what I need to add to each of the three files? Some of it is in purple and some in white without a distinction between the two. Can you also tell me why the $startDate line is commented out? Any help would be greatly appreciated.



3. ficial - July 29, 2008

Hi Jason,

Sorry about the purple/white mess – that’s an artifact of the wordpress rendering engine. Anyway:

At the start of the EC_Calendar class (in the ec_calendar.class.php file, just before the displayEventList function) I added the displayEventLargeList function as shown above as the first function inside that class. The $startDate line is commented out because that’s the way it was in the original displayEventList function that I largely copied for the new function. $startDate is defined a couple of lines up – you could just delete that commented line if the aesthetics bother you :)

In events-calendar.php I add two things. First, just before the SidebarEventsCalendar function I define a new function called filterEventsListLarge, which is shown above (entirely in purple, by coincidence). Then further down, just after the line:
add_filter(‘the_content’, ‘filterEventsCalendarLarge’);
I added another filter call:
add_filter(‘the_content’, ‘filterEventsListLarge’);

Finally, I altered the css/events-calendar.css file to control the display of the large format list. I added the above CSS just before the spec for #todayLarge.

4. Jason - July 29, 2008

Thanks so much for the clarification. That’s exactly what I tried, but I just figured out the problem was that for some reason when I copied the code from this page dreamweaver didn’t like the single and double quotes so I had to go back through and retype each one. Works great now. Exactly what I was looking to do. Thanks again,


5. nicole - October 10, 2008

Hi — thanks for this modification … I have followed exactly these instructions but am having trouble getting either the [[EventsCalendarLarge]] or [[EventListLarge]] to actually show up in my posts … I insert them in the html of the page but they just show up as they are typed. I’m kind of a dummy when it comes to programming, is there something else I am supposed to type around the statements, or …?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: