<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Events Made Easy support &#187; Topic: TIP: Generate a dynamic sitemap of events</title>
		<link>http://www.e-dynamics.be/bbpress/topic.php?id=1801</link>
		<description>Support for the wordpress Events Made Easy plugin</description>
		<language>en-US</language>
		<pubDate>Mon, 20 May 2013 09:29:29 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.e-dynamics.be/bbpress/search.php</link>
		</textInput>
		<atom:link href="http://www.e-dynamics.be/bbpress/rss.php?topic=1801" rel="self" type="application/rss+xml" />

		<item>
			<title>Franky on "TIP: Generate a dynamic sitemap of events"</title>
			<link>http://www.e-dynamics.be/bbpress/topic.php?id=1801#post-8144</link>
			<pubDate>Thu, 25 Apr 2013 10:02:35 +0000</pubDate>
			<dc:creator>Franky</dc:creator>
			<guid isPermaLink="false">8144@http://www.e-dynamics.be/bbpress/</guid>
			<description>&#60;p&#62;Yes, I know why you created the sitemap, but why not submit an RSS feed?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>tomchubb on "TIP: Generate a dynamic sitemap of events"</title>
			<link>http://www.e-dynamics.be/bbpress/topic.php?id=1801#post-8142</link>
			<pubDate>Thu, 25 Apr 2013 09:17:30 +0000</pubDate>
			<dc:creator>tomchubb</dc:creator>
			<guid isPermaLink="false">8142@http://www.e-dynamics.be/bbpress/</guid>
			<description>&#60;p&#62;Hi Franky,&#60;br /&#62;
The reason for this was that my events weren't getting indexed by Google.&#60;br /&#62;
After submitting a Sitemap to Google Webmaster Tools then the events started getting indexed.&#60;br /&#62;
I can't 'guarantee' that was the reason, but it certainly made it easier to see that events were getting added. Also it allowed me to tell google how often to re-index and when the last modified date was.&#60;br /&#62;
Thanks,&#60;/p&#62;
&#60;p&#62;Tom
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Franky on "TIP: Generate a dynamic sitemap of events"</title>
			<link>http://www.e-dynamics.be/bbpress/topic.php?id=1801#post-8128</link>
			<pubDate>Wed, 24 Apr 2013 13:05:19 +0000</pubDate>
			<dc:creator>Franky</dc:creator>
			<guid isPermaLink="false">8128@http://www.e-dynamics.be/bbpress/</guid>
			<description>&#60;p&#62;I just took another look at this, and was wondering: if you submit this to google, why not just submit the RSS feed with &#34;scope=all&#34; to google (which seems an accepted format as well)?&#60;br /&#62;
I can add the code of course, but need to understand this :-) Also: your query doesn't take into account private events.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Franky on "TIP: Generate a dynamic sitemap of events"</title>
			<link>http://www.e-dynamics.be/bbpress/topic.php?id=1801#post-7067</link>
			<pubDate>Tue, 01 May 2012 23:24:21 +0000</pubDate>
			<dc:creator>Franky</dc:creator>
			<guid isPermaLink="false">7067@http://www.e-dynamics.be/bbpress/</guid>
			<description>&#60;p&#62;I edited it because of backtick problems, you might want to review the resulting code (no telling what got lost because of bbpress issues with backticks)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>tomchubb on "TIP: Generate a dynamic sitemap of events"</title>
			<link>http://www.e-dynamics.be/bbpress/topic.php?id=1801#post-7065</link>
			<pubDate>Tue, 01 May 2012 13:45:48 +0000</pubDate>
			<dc:creator>tomchubb</dc:creator>
			<guid isPermaLink="false">7065@http://www.e-dynamics.be/bbpress/</guid>
			<description>&#60;p&#62;OK - I completely re-wrote this as I wanted to show the modified date in the &#38;lt;lastmod&#38;gt; tag as there was no EME placeholder to use. (I'm using the value from modif_date in the eme_events table.)&#60;/p&#62;
&#60;p&#62;Here's my next version:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
require(&#38;#39;/path/to/httpdocs/wp-blog-header.php&#38;#39;);
global $wpdb;

$sql = &#38;quot;SELECT * FROM &#38;quot; . $wpdb-&#38;gt;prefix . &#38;quot;eme_events ORDER BY &#38;#39;wp_eme_events&#38;#39;.&#38;#39;event_start_date&#38;#39; DESC&#38;quot;;
$events = $wpdb-&#38;gt;get_results($sql);  // Run our query, getting results as an object
	if (!empty($events)) { // If the query returned something

		$header = &#38;quot;&#38;lt;?xml version=\&#38;quot;1.0\&#38;quot; encoding=\&#38;quot;UTF-8\&#38;quot;?&#38;gt;\n&#38;quot; . &#38;quot;&#38;lt;urlset xmlns=\&#38;quot;http://www.sitemaps.org/schemas/sitemap/0.9\&#38;quot;&#38;gt;\n&#38;quot;;
		$urls = &#38;quot;&#38;quot;;
		$footer = &#38;quot;&#38;lt;/urlset&#38;gt;&#38;quot;;
		foreach ($events as $event) {  // Loop though our results!
			// Build Sitemap Elements
			$locurl = &#38;quot;http://www.yourdomain.com/events/$event-&#38;gt;event_id/$event-&#38;gt;event_slug&#38;quot;;
			// Format the date
			$lastmod = date(&#38;#39;Y-m-d&#38;#39;, strtotime($event-&#38;gt;modif_date));
			// Concatenate List of URLs
			//$urls .= &#38;#39;	&#38;lt;url&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot; . &#38;#39;		&#38;lt;loc&#38;gt;&#38;#39; . $locurl . &#38;#39;&#38;lt;/loc&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot; . &#38;#39;		&#38;lt;priority&#38;gt;0.5&#38;lt;/priority&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot; . &#38;#39;		&#38;lt;lastmod&#38;gt;&#38;#39; . $lastmod . &#38;#39;&#38;lt;/lastmod&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot; . &#38;#39;	&#38;lt;/url&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot;;
			$urls .= &#38;quot;	&#38;lt;url&#38;gt;\n		&#38;lt;loc&#38;gt;$locurl&#38;lt;/loc&#38;gt;\n		&#38;lt;priority&#38;gt;0.5&#38;lt;/priority&#38;gt;\n		&#38;lt;lastmod&#38;gt;$lastmod&#38;lt;/lastmod&#38;gt;\n	&#38;lt;/url&#38;gt;\n&#38;quot;;
		 }
	// Print Sitemap
	$xmlsitemap = $header . $urls . $footer;
	//echo $xmlsitemap;
	} 

// Write to file
$myFile = &#38;quot;/path/to/httpdocs/sitemap.xml&#38;quot;;
$fh = fopen($myFile, &#38;#39;w&#38;#39;) or die(&#38;quot;can&#38;#39;t open file&#38;quot;);
fwrite($fh, $xmlsitemap);
fclose($fh);
echo &#38;quot;Sitemap Updated&#38;quot;;

?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Franky on "TIP: Generate a dynamic sitemap of events"</title>
			<link>http://www.e-dynamics.be/bbpress/topic.php?id=1801#post-7060</link>
			<pubDate>Tue, 01 May 2012 00:54:07 +0000</pubDate>
			<dc:creator>Franky</dc:creator>
			<guid isPermaLink="false">7060@http://www.e-dynamics.be/bbpress/</guid>
			<description>&#60;p&#62;Hmm ... I don't recall ever saying anything specific about sitemaps, but anyway: thanks for the tip!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>tomchubb on "TIP: Generate a dynamic sitemap of events"</title>
			<link>http://www.e-dynamics.be/bbpress/topic.php?id=1801#post-7056</link>
			<pubDate>Sun, 29 Apr 2012 15:11:38 +0000</pubDate>
			<dc:creator>tomchubb</dc:creator>
			<guid isPermaLink="false">7056@http://www.e-dynamics.be/bbpress/</guid>
			<description>&#60;p&#62;I know there are a lot of questions over whether sitemaps are required or not which is why I accept Franky's decision to prevent this from being a feature, however I wanted to ensure that my events were all submitted to Google via a dedicated events sitemap and thought I'd share my solution hoping that it may help someone.&#60;/p&#62;
&#60;p&#62;I know it's messy and any suggestions are welcome:&#60;/p&#62;
&#60;p&#62;&#38;lt;?php require('wp-blog-header.php'); ?&#38;gt;&#60;br /&#62;
&#38;lt;?php include('http://www.yourdomain.com/wp-content/plugins/events-made-easy/eme_functions.php'); ?&#38;gt;&#60;br /&#62;
&#38;lt;?php&#60;br /&#62;
ob_start(); // Turn on output buffering&#60;br /&#62;
$eme_sitemap_data = eme_get_events_list('limit=0&#38;amp;scope=all&#38;amp;order=DESC&#38;amp;format=&#38;lt;url&#38;gt;' . &#34;\n&#34; . '  &#38;lt;loc&#38;gt;#_EVENTPAGEURL&#38;lt;/loc&#38;gt;' . &#34;\n&#34; . '  &#38;lt;priority&#38;gt;0.7&#38;lt;/priority&#38;gt;' . &#34;\n&#34; . '&#38;lt;/url&#38;gt;');&#60;br /&#62;
$sitemap = ob_get_contents();&#60;br /&#62;
ob_end_clean();&#60;/p&#62;
&#60;p&#62;// Build XML Sitemap&#60;br /&#62;
$sitemap_data = &#34;&#38;lt;?xml version=\&#34;1.0\&#34; encoding=\&#34;UTF-8\&#34;?&#38;gt;\n&#34; . &#34;&#38;lt;urlset xmlns=\&#34;http://www.sitemaps.org/schemas/sitemap/0.9\&#34;&#38;gt;&#34; . $sitemap . &#34;\n&#34; . &#34;&#38;lt;/urlset&#38;gt;&#34;; ?&#38;gt;&#60;br /&#62;
&#38;lt;?php&#60;br /&#62;
// Write to XML file&#60;br /&#62;
$myFile = &#34;events-sitemap.xml&#34;;&#60;br /&#62;
$fh = fopen($myFile, 'w') or die(&#34;can't open file&#34;);&#60;br /&#62;
fwrite($fh, $sitemap_data);&#60;br /&#62;
fclose($fh);&#60;br /&#62;
echo &#34;Sitemap generated&#34;;&#60;br /&#62;
?&#38;gt;&#60;/p&#62;
&#60;p&#62;Then you can set a scheduled task to run the script every hour or so...
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
