Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Add sortable headers to wordpress calendar plugin

Posted on 2009-03-31
3
Medium Priority
?
683 Views
Last Modified: 2012-06-21
Hello all,
I'm using a wordpress blog plugin called "Gigs Calendar" (http://wordpress.org/extend/plugins/gigs-calendar/) the calendar list shows the event name, date, and venue, etc through the use of a template. (Check out http://businessethics.tv/jewishneighbor/?page_id=2 to see an example.) I'd like to make the headers sort the entries.  I've pasted the code from the list template page below. Is there a simple way to add this? Thanks much!
<div class="gigs-calendar">
	<table class="gigs calendar <?php echo $upcoming ? 'upcoming' : 'archive' ?>">
		<?php if ( !empty($caption) ) : ?>
			<caption><?php echo $caption; ?></caption>
		<?php endif; ?>
		<?php if ( $options['list-headers'] ) : ?>
			<thead><tr>
				<?php foreach ( $show_fields as $field ) : ?>
					<th><?php echo $listFields[$field]; ?></th>
				<?php endforeach; ?>
			</tr></thead>
		<?php endif; ?>
		<tbody>
			<?php foreach ( $gigs as $gkey => $g ) : ?>
				<?php foreach ( $g->performances as $key => $p ) : ?>
					<tr id="performance-<?php echo $p->id; ?>" class="<?php echo ($gkey % 2) ? 'even' : 'odd'; ?> <?php echo $key == 0 ? 'gig' : 'performance'; ?> gig-<?php echo $g->id; ?> <?php echo dtcGigs::get_gig_css_classes($g) ?>">
						<?php 
							if ( $key == 0 ) {
								$fields = array(
									'city' => '<td class="city" valign="top">{' . $g->cityState . '}</td>',
									'country' => '<td class="country" valign="top">{' . $g->country . '}</td>',
									'venue' => '<td class="venue" valign="top">{' . $g->name . '}</td>',
									'eventName' => '<td class="eventName" valign="top">{' . $g->eventName . '}</td>',
									'date' => '<td class="date" valign="top">{' . $g->date . '}</td>',
									'time' => '<td class="time" valign="top">{' . $p->time . '}</td>',
									'shortNotes' => '<td class="shortNotes" valign="top">{' . $p->shortNotes . '}</td>',
									'tickets' => ( $upcoming ? '<td class="tickets icon" valign="top">' . ( !empty($p->link) ? '<a target="_blank" href="' . $p->link . '"><img alt="' . __('Buy Tickets', $gcd) . '" title="' . __('Buy Tickets', $gcd) . '" class="clickable tickets" src="' . $folder . 'images/money_dollar.png" /></a>' : '') . '</td>' : '' ),
									'map' => '<td class="map icon" valign="top">' . ($g->mapLink ? '<a target="_blank" href="' . $g->mapLink . '"><img alt="' . __('Map', $gcd) . '" title="' . __('Map', $gcd) . '" class="clickable map" src="' . $folder . 'images/world.png" /></a>' : '') . '</td>',
								);
							} else {
								$fields = array(
									'city' => '<td class="city" valign="top"></td>',
									'country' => '<td class="country" valign="top"></td>',
									'venue' => '<td class="venue" valign="top"></td>',
									'eventName' => '<td class="eventName" valign="top"></td>',
									'date' => '<td class="date" valign="top"></td>',
									'time' => '<td class="time" valign="top">{' . $p->time . '}</td>',
									'shortNotes' => '<td class="shortNotes" valign="top">{' . $p->shortNotes . '}</td>',
									'tickets' => ( $upcoming ? '<td class="tickets icon" valign="top">' . ( !empty($p->link) ? '<a target="_blank" href="' . $p->link . '"><img alt="' . __('Buy Tickets', $gcd) . '" title="' . __('Buy Tickets', $gcd) . '" class="clickable tickets" src="' . $folder . 'images/money_dollar.png" /></a>' : '') . '</td>' : '' ),
									'map' => '<td class="map icon" valign="top"></td>',
								);
							}
							echo dtcGigs::selectFields($fields, $g);
						?>
					</tr>
				<?php endforeach; ?>
			<?php endforeach; ?>
		</tbody>
	</table>
	<?php if ( empty($gigs) && $upcoming ) : ?>
		<div class="no-gigs"><?php echo $options['no-upcoming']; ?></div>
	<?php elseif ( empty($gigs) ) : ?>
		<div class="no-gigs"><?php echo $options['no-past']; ?></div>
	<?php endif; ?>
</div>

Open in new window

0
Comment
Question by:frittonweb
  • 2
3 Comments
 
LVL 21

Accepted Solution

by:
oleggold earned 2000 total points
ID: 24103149
0
 
LVL 21

Assisted Solution

by:oleggold
oleggold earned 2000 total points
ID: 24103150
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question