<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SEOserpent &#187; event manager</title>
	<atom:link href="http://seoserpent.com/tag/event-manager/feed" rel="self" type="application/rss+xml" />
	<link>http://seoserpent.com</link>
	<description>A search marketing company.</description>
	<lastBuildDate>Mon, 06 Feb 2012 19:08:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Events Manager Plugin &#8211; Hack to display events by categories</title>
		<link>http://seoserpent.com/wordpress/events-manager-plugin</link>
		<comments>http://seoserpent.com/wordpress/events-manager-plugin#comments</comments>
		<pubDate>Mon, 15 Feb 2010 21:37:14 +0000</pubDate>
		<dc:creator>Marty Martin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[event manager]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://seoserpent.com/?p=113</guid>
		<description><![CDATA[I have a client who uses the Events Manager plugin by Davide Benini and Marcus Skyes to manage events on their site. Unfortunately, the plug-in doesn&#8217;t let you display events by category (which is weird, otherwise, why have the categories?) but anyway, I wrote/hacked together a custom function and WordPress shortcode today to display the [...]]]></description>
			<content:encoded><![CDATA[<p>I have a client who uses the <a href="http://davidebenini.it/wordpress-plugins/events-manager/">Events Manager plugin</a> by Davide Benini and Marcus Skyes to <a href="http://wordpress.org/extend/plugins/events-manager/">manage events</a> on their site.</p>
<p>Unfortunately, the plug-in doesn&#8217;t let you display events by category (which is weird, otherwise, why have the categories?) but anyway, I wrote/hacked together a custom function and WordPress shortcode today to display the events by category.</p>
<p>Now, I know there are going to be the naysayers who say &#8220;This code isn&#8217;t very pretty&#8221;.  Yeah, well maybe not but it works.  And if you can improve on it, DO!  I&#8217;m totally open to it.  For instance, the edit I did makes more than one query to the DB which isn&#8217;t optimal.</p>
<p>Okay, so without further ado, here it is.  Open up the file in your events-manager/ folder called &#8216;marcus-extras.php&#8217;.  Around line 264 you&#8217;ll find a function called dbem_get_category().  I added my custom function and shortcode right below it :</p>
<pre class="brush: php; title: ; notranslate">
define('DBEM_EVENTS_TBNAME', 'dbem_events');
</pre>
<p>And then:</p>
<pre class="brush: php; title: ; notranslate">
function dbem_display_categories() {
	global $wpdb;
	$categories_table = $wpdb-&gt;prefix.DBEM_CATEGORIES_TBNAME;
	$events_table = $wpdb-&gt;prefix.DBEM_EVENTS_TBNAME;
	$sql_categories = mysql_query(&quot;SELECT * FROM $categories_table ORDER BY category_id&quot;);
	while($category = mysql_fetch_assoc($sql_categories)) {
		extract($category);
		$events = mysql_query(&quot;SELECT * FROM $events_table WHERE event_category_id = '&quot;.mysql_real_escape_string($category_id).&quot;' ORDER BY event_start_date ASC&quot;);
		$category_list .= &quot;&lt;div class=\&quot;event\&quot;&gt;&quot;;
		$category_list .= &quot;&lt;h2&gt;$category_name&lt;/h2&gt;&quot;;
		while($event = mysql_fetch_assoc($events)) {
			extract($event);
			$start_date = date('m/d/Y',strtotime($event_start_date));
			$end_date = date('m/d/Y',strtotime($event_end_date));
			$category_list .= &quot;&lt;li&gt;Event: &lt;strong&gt;&lt;a href=\&quot;http://www.wilderness-adventure.com/camp-dates/?event_id=$event_id\&quot; title=\&quot;$event_name\&quot;&gt;$event_name&lt;/a&gt;&lt;/strong&gt;
					&lt;ul&gt;
						&lt;li&gt;Dates: $start_date - $end_date&lt;/li&gt;
					&lt;/ul&gt;&lt;/li&gt;&quot;;
		}
		$category_list .= &quot;&lt;/div&gt;&quot;;
	}
	echo $category_list;
}
add_shortcode('dbem_events_by_category', 'dbem_display_categories');
</pre>
<p>The shortcode is &#8211; [dbem_events_by_category] and you can just insert it into your post or page whereever you want it to go.</p>
<p>By default it outputs ALL events under ALL categories but you could hack it up pretty easily to only display one category, etc.  I may do that later if enough people ask for it but it&#8217;s not what I needed so, didn&#8217;t get done.  :)</p>
<p>Hope this helps some folks.  Let me know if you have any questions!</p>
]]></content:encoded>
			<wfw:commentRss>http://seoserpent.com/wordpress/events-manager-plugin/feed</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
	</channel>
</rss>

