<?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>Themocracy WordPress Themes &#187; Barrie</title>
	<atom:link href="http://themocracy.com/author/barrie/feed/" rel="self" type="application/rss+xml" />
	<link>http://themocracy.com</link>
	<description>WordPress Theme Design</description>
	<lastBuildDate>Mon, 26 Jul 2010 06:18:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>A Flickr Badge using WordPress Shortcodes</title>
		<link>http://themocracy.com/2010/03/a-flickr-badge-using-wordpress-shortcodes/</link>
		<comments>http://themocracy.com/2010/03/a-flickr-badge-using-wordpress-shortcodes/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 11:22:30 +0000</pubDate>
		<dc:creator>Barrie</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=271</guid>
		<description><![CDATA[Flickr provides a neat little snippet of javaScript to supply various image galleries direct to your site - a so-named Flickr badge. Here's a good way using WordPress shortcodes to grab a gallery...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F03%2Fa-flickr-badge-using-wordpress-shortcodes%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F03%2Fa-flickr-badge-using-wordpress-shortcodes%2F" height="61" width="51" /></a></div><p><img src="http://themocracy.com/wp-content/uploads/2010/03/flickr-wordpress.jpg" alt="Flickr" title="flickr-wordpress" width="160" height="148" class="alignright size-full wp-image-272" /><strong>Flickr provides a neat little snippet of javaScript to supply various image galleries direct to your site &#8211; a so-named Flickr badge.</strong></p>
<p>So if your gallery is on Flickr &#8211; rather in your WordPress, which has its own gallery shortcode &#8211; a shortcode in the blog post content can be used to embed a gallery of thumbnail images, which is also a good way to demonstrate the various usages of WordPress shortcodes.</p>
<p>The HTML for a flickr badge looks something like this:-</p>
<pre class="brush: html">

&lt;div class=&quot;flickr_badge&quot;&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.flickr.com/badge_code_v2.gne?count=5&amp;display=latest&amp;size=m&amp;layout=h&amp;source=all_tag&amp;tag=fish&quot;&gt;&lt;/script&gt;&lt;/div&gt;
</pre>
<p>And the parameters work like this:-</p>
<p><strong>count</strong> <em> integer</em> 1-10. Default is 10.</p>
<p><strong>display</strong> <em>string</em> &#8216;latest&#8217; or &#8216;random&#8217;  Default is latest. </p>
<p><strong>layout</strong> <em>string</em> h, v, x - Photos are listed horizontally, vertically, or no style. Default is horizontal.  </p>
<p><strong>source</strong> <em>string</em> user, user_tag, user_set, group, group_tag, all, all_tag </p>
<p>Source implies which &#8216;account&#8217; the photos come from:- a specified user, a user set, a group, or all users, then filtered by tag if required.  Further parameters may then be required, user(ID string)  tag (string), group (integer), and set (integer,  the url …/sets/1234567/).  </p>
<p><strong>size</strong> <em>string</em> s, t, m   s stands for square (cropped, not small&#8230;), t for thumbnail, and m for medium.  t = thumbnail is the default.</p>
<p>(<a href="http://idgettr.com/">idgettr</a> is very useful for figuring out user IDs and the IDs for photosets, groups etc.)</p>
<p><strong>WordPress Shortcodes</strong></p>
<p>A shortcode has a &#8220;handler function&#8221; &#8211; which is integrated into the code by calling the function <strong>add_shortcode()</strong>. The purpose here is to supply the various parameters for our Flickr badge as parameters of the function &#8211; the query string for the Flickr call is then constructed and the javascript code output to the page.</p>
<p>In <strong>functions.php</strong></p>
<pre class="brush: php">

function flickr_badge_shortcode($atts){

//Here&#039;s our defaults
$query_atts = shortcode_atts(array(&#039;count&#039; =&gt; &#039;6&#039;, &#039;display&#039; =&gt; &#039;latest&#039;, &#039;source&#039; =&gt; &#039;user&#039;, &#039;size&#039; =&gt; &#039;t&#039;, &#039;user&#039; =&gt; &#039;&#039;, &#039;layout&#039; =&gt; &#039;x&#039;, &#039;tag&#039; =&gt; &#039;&#039;, &#039;group&#039; =&gt; &#039;&#039;, &#039;set&#039; =&gt; &#039;&#039;), $atts); 

 	return sprintf(&#039;&lt;div class=&quot;flickr_badge&quot;&gt;&lt;script src=&quot;http://www.flickr.com/badge_code_v2.gne?%s&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&lt;/div&gt;
&#039;, http_build_query($query_atts));
}

add_shortcode(&#039;flickrbadge&#039;, &#039;flickr_badge_shortcode&#039;);
</pre>
<p>Provided you have PHP5 on the server, <strong>http_build_query()</strong> is the quick and easy way of building a query string from an array &#8211; and it&#8217;s urlencoded&#8230;.</p>
<p>Note that the empty parameters group, set etc. are required in the defaults &#8211; otherwise nothing gets passed to the constructed url via shortcode_atts().</p>
<p>So now, in a post content you can apply the shortcode tag:</p>
<p><strong>[flickrbadge count="4" layout="h" display="latest" size="t" source="all_tag" tag="fish"]</strong></p>
<p>And you should get a nice gallery of Flickr images for users to check out &#8211; once you&#8217;ve added some CSS to style the images (note the possible uses of the layout parameter here).</p>
<p>This example was of the selfclosing shortcode tag &#8211; but you can elaborate a bit, to inject more content into the shortcode function. The simplest example would be to give the gallery a custom title.</p>
<p>Again in functions.php</p>
<pre class="brush: php">

function flickr_badge_shortcode($atts, $content=NULL){

//Here&#039;s our defaults
$query_atts = shortcode_atts(array(&#039;count&#039; =&gt; &#039;6&#039;, &#039;display&#039; =&gt; &#039;latest&#039;, &#039;source&#039; =&gt; &#039;user&#039;, &#039;size&#039; =&gt; &#039;t&#039;, &#039;user&#039; =&gt; &#039;&#039;, &#039;layout&#039; =&gt; &#039;x&#039;, &#039;tag&#039; =&gt; &#039;&#039;, &#039;group&#039; =&gt; &#039;&#039;, &#039;set&#039; =&gt; &#039;&#039;), $atts);

return sprintf(&#039;&lt;div class=&quot;flickr_badge&quot;&gt;&lt;h3&gt;%s&lt;/h3&gt;&lt;script src=&quot;http://www.flickr.com/badge_code_v2.gne?%s&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&lt;/div&gt;&#039;, $content, http_build_query($query_atts));
}

add_shortcode(&#039;flickrbadge&#039;, &#039;flickr_badge_shortcode&#039;);
</pre>
<p>And would be called from the post content with opening and closing shortcode tags:</p>
<p><strong>[flickrbadge count="4" layout="h" display="latest" size="t" source="all_tag" tag="fish"]Here&#8217;s the latest fish[/flickrbadge]</strong></p>
<p><strong>Caution!</strong><br />
Best to avoid camelCase notation in the attributes &#8211; the regex that the content is passed through to locate shortcodes  is case-insensitive.<br />
Always remember to use <strong>return</strong> in the handler function and not <strong>echo</strong>  (in this example sprintf, not printf). It&#8217;ll appear on the page &#8211; but not in the right place&#8230;</p>
<p>WordPress shortcodes are relatively simple in concept, but can be a bit fiddly in practice, keeping track of the default parameters and the use of  shortcode_atts() just needs a bit of thinking about sometimes&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/03/a-flickr-badge-using-wordpress-shortcodes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Calendar Functions</title>
		<link>http://themocracy.com/2010/02/php-calendar-functions/</link>
		<comments>http://themocracy.com/2010/02/php-calendar-functions/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 14:24:22 +0000</pubDate>
		<dc:creator>Barrie</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=264</guid>
		<description><![CDATA[It's really easy to get really mixed up when trying to program with date functions - lots to keep track of, calendars, timezones, daylight saving, weird months that have different numbers of days in them...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fphp-calendar-functions%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fphp-calendar-functions%2F" height="61" width="51" /></a></div><p><img src="http://themocracy.com/wp-content/uploads/2010/02/wordpress-calendar.gif" alt="" title="wordpress-calendar" width="128" height="128" class="alignright size-full wp-image-265" />It&#8217;s really easy to get really mixed up when trying to program with date functions &#8211; lots to keep track of, calendars, timezones, daylight saving, weird months that have different numbers of days in them&#8230;</p>
<p><strong>Here&#8217;s a quick rundown on the main PHP functions involved.</strong> </p>
<h3>1. checkdate()</h3>
<blockquote><p>
bool <strong>checkdate </strong> ( int $month  , int $day  , int $year  )
</p></blockquote>
<p>Does just what it says, for the Gregorian calendar, and it&#8217;s been around since PHP4 &#8211; a very quick way to ensure that the programming isn&#8217;t coming up with any silly results. Always useful!</p>
<h3>2.. date() and gmdate()</h3>
<p>From a given UNIX timestamp, <strong>date()</strong> tells you what time would be in your server timezone and <strong>gmdate()</strong> tells you what GMT it would be (or UTC, the same thing&#8230;). It is important to get the hang of the consequences of this and one way of figuring it out is to bear in mind the date() format character &#8220;Z&#8221; &#8211; the timezone offset in seconds, positive or negative. </p>
<p>No matter what the timezone is set to, these 2 expressions will produce the same result&#8230;</p>
<pre class="brush: php">
&lt;?php
	date_default_timezone_set(&#039;America/Montreal&#039;);

	echo date(&quot;Y/m/d H:i:s&quot;,(time()));
	echo gmdate(&quot;Y/m/d H:i:s&quot;,(time()+ date(&quot;Z&quot;)));

?&gt;
</pre>
<h3>3. strtotime()</h3>
<p>Takes a string and should return a Unix timestamp.</p>
<p>It does say string in &#8220;US English date format&#8221; &#8211; which means that for strtotime (&#8220;04/06/2010&#8243;) is April 6th, and not the 4th of June. (Probably no need to get into a discussion about the relative logic of the two systems here).</p>
<p><strong>strtotime</strong> has a pretty decent understanding of language &#8211; so you can do relative times:</p>
<pre class="brush: php">
strtotime(&#039;next Monday&#039;);
strtotime(&#039;+1 years&#039;);
strtotime(&#039;first day next month&#039;);
strtotime(&#039;2010-02 last day&#039;);
</pre>
<p>All return what you&#8217;d expect, based on the datetime the function&#8217;s run&#8230;</p>
<h3>4. mktime()</h3>
<p>Good for catching &#8220;overflows&#8221;. </p>
<pre class="brush: php">
echo date(&quot;M-d-Y&quot;, mktime(0, 0, 0, 12, 32, 2009)) // =&gt; Jan-01-2010
echo date(&quot;M-d-Y&quot;, mktime(0, 0, 0, 15, 31, 2009)) // =&gt; Mar-31-2010
</pre>
<p>Like strtotime, mktime doesn&#8217;t go in unit magnitude order &#8211; it&#8217;s hours, minutes, seconds, months, days, years&#8230;. why? because that&#8217;s the decision that was made&#8230;</p>
<p><strong>Find a birth day with mktime:-</strong></p>
<pre class="brush: php">
	$my_birthdate = mktime(0,0,0,5,12,72);
	print date(&quot;l&quot;, $my_birthdate);
	//gives:   Friday
</pre>
<h3>A Few  More Calendar Tricks</h3>
<p><strong>Current age</strong></p>
<pre class="brush: php">
&lt;?php  echo floor(abs(strtotime(&#039;Y&#039;) - strtotime(&#039;02/22/1968&#039;))/31536000);  ?&gt;
</pre>
<p><strong>Easter date</strong></p>
<pre class="brush: php">
&lt;?php echo date(&quot;M-d-Y&quot;, easter_date(2010));   ?&gt;     // Apr-04-2010
</pre>
<p><strong>Datetime constants</strong><br />
PHP 5.1 and later, via the DateTime class, offers a few shorthand formatting strings.</p>
<pre class="brush: php">
&lt;?php echo date(DATE_RSS); ?&gt;
//gives something like: Thu, 21 Feb 2010 09:35:44 -0800
</pre>
<p>The defined strings are <a href="http://us.php.net/manual/en/class.datetime.php#datetime.constants.types">here</a> &#8211; also good for cookies.</p>
<p><strong>Daylight Saving Problems</strong><br />
One way of cutting out possible problems with daylight saving time differences across timezones is to work in UTC, using expressions like these (and then revert back to a local timezone at the end if necessary).</p>
<pre class="brush: php">
date_default_timezone_set(&#039;UTC&#039;);

$date_utc = strtotime($date. &quot; UTC&quot;);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/php-calendar-functions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Expressivo (Center) Free WordPress Theme</title>
		<link>http://themocracy.com/2010/02/expressivo-center-free-wordpress-theme/</link>
		<comments>http://themocracy.com/2010/02/expressivo-center-free-wordpress-theme/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 10:09:45 +0000</pubDate>
		<dc:creator>Barrie</dc:creator>
				<category><![CDATA[Free]]></category>
		<category><![CDATA[Themes]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=267</guid>
		<description><![CDATA[Expressivo (Center) is a free WordPress theme - based on Expressivo - a three-column layout, but with the blog post content centered. It's got the same feature list - a jQuery dropdown pages menu, Cufon embedded fonts for post titles, a custom header image and threaded and paged comments.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fexpressivo-center-free-wordpress-theme%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fexpressivo-center-free-wordpress-theme%2F" height="61" width="51" /></a></div><p><a href="http://themocracy.com/demo/?t=9"><img src="http://themocracy.com/wp-content/uploads/2010/02/expressivo_center_wp_theme.jpg" alt="Expressivo (center) wordpress theme" title="expressivo_center_wp_theme" width="253" height="171" class="alignright size-full wp-image-268" /></a><strong>Expressivo (Center)</strong> is a free WordPress theme &#8211; based on Expressivo &#8211; a three-column layout, but with the blog post content centered. It&#8217;s got the same feature list &#8211; a jQuery dropdown pages menu, Cufon embedded fonts for post titles, a custom header image and threaded and paged comments.<br />
<span id="more-267"></span><br />
Version 1.1 has been tested on Firefox 3, Google Chrome, Internet Explorer 6 &amp; 7 and Opera 9.</p>
<p><strong>Features</strong></p>
<ul>
<li>Add your own header image or logo</li>
<li>jQuery dropdown menu  for pages &#8211; exclude and configure the item order</li>
<li>Cufon Embedded fonts</li>
<li>Custom link and hover colors</li>
</ul>
<p><strong>Demo:</strong> <a href="http://themocracy.com/demo/?t=9">Expressivo (Center) demonstration</a></p>
<p><img style="vertical-align:-5px;" class="alignnone size-full wp-image-234" title="theme download" src="http://themocracy.com/wp-content/uploads/2010/02/download_small.gif" alt="theme download" width="25" height="24" /> <strong>Download</strong>: Expressivo (Center) WordPress Theme v1.1 &#8211; <a href="http://themocracy.com/extra/themes/expressivo-center.zip">expressivo-center.zip</a> Compatible with WP > version <b>2.8</b></p>
<p>This theme is released under the terms of the GPL licence v2.</p>
<p>Our free themes are supplied &#8220;as is&#8221; &#8211; <em>sorry, but we don&#8217;t have the resources to offer support for email enquiries or comments about individual installation/customisation</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/expressivo-center-free-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mistral Free WordPress Theme</title>
		<link>http://themocracy.com/2010/02/mistral-free-wordpress-theme/</link>
		<comments>http://themocracy.com/2010/02/mistral-free-wordpress-theme/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 10:09:26 +0000</pubDate>
		<dc:creator>Barrie</dc:creator>
				<category><![CDATA[Free]]></category>
		<category><![CDATA[Themes]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=269</guid>
		<description><![CDATA[Mistral is a free WordPress theme – a two-column layout, with a righthand sidebar. Plus a static pages menu, Cufon embedded fonts for widget headings, a replaceable logo area and paged- and threaded- comments.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fmistral-free-wordpress-theme%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fmistral-free-wordpress-theme%2F" height="61" width="51" /></a></div><p><a href="http://themocracy.com/demo/?t=10"><img src="http://themocracy.com/wp-content/uploads/2010/02/mistral-free-wordress-theme.jpg" alt="Mistral WordPress Theme" title="mistral free wordress theme" width="260" height="186" class="alignright size-full wp-image-270" /></a><strong>Mistral</strong> is a free WordPress theme &#8211; a two-column layout, with a righthand sidebar. Plus a static pages menu, Cufon embedded fonts for widget headings, a replaceable logo area and paged- and threaded- comments.<br />
<span id="more-269"></span><br />
Version 1.1 has been tested on Firefox 3,  Internet Explorer 6 &amp; 7, Google Chrome and Opera 9.</p>
<p><strong>Features</strong></p>
<ul>
<li>Replace blog info header with your own logo / design</li>
<li>Cufon embedded fonts for widget headings</li>
<li>Customized link and hover colors</li>
</ul>
<p><strong>Demo:</strong> <a href="http://themocracy.com/demo/?t=10">Mistral demonstration</a></p>
<p><img style="vertical-align:-5px;" class="alignnone size-full wp-image-234" title="theme download" src="http://themocracy.com/wp-content/uploads/2010/02/download_small.gif" alt="theme download" width="25" height="24" /> <strong>Download</strong>: Mistral WordPress Theme v1.1 &#8211; <a href="http://themocracy.com/extra/themes/mistral.zip">mistral.zip</a> Compatible with WP > version <b>2.9</b></p>
<p>This theme is released under the terms of the GPL licence, v2.</p>
<p>Our free themes are supplied &#8220;as is&#8221; &#8211; <em>sorry, but we don&#8217;t have the resources to offer support for email enquiries or comments about individual installation/customisation</em>. </p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/mistral-free-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WP-Cron &#8211; automating and scheduling</title>
		<link>http://themocracy.com/2010/02/wp-cron-automating-scheduling/</link>
		<comments>http://themocracy.com/2010/02/wp-cron-automating-scheduling/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 06:51:03 +0000</pubDate>
		<dc:creator>Barrie</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=260</guid>
		<description><![CDATA[You need a cron job in your WordPress blog - something run to a schedule, hourly, daily...  Instead of fixing up a crontab and using wget or lynx, you can use WordPress's internal version of the cron job.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fwp-cron-automating-scheduling%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fwp-cron-automating-scheduling%2F" height="61" width="51" /></a></div><p><strong>You need a cron job in your WordPress blog</strong> &#8211; something run to a schedule, hourly, daily&#8230;  Instead of fixing up a crontab and using wget or lynx, you can use WordPress&#8217;s internal version of the cron job.</p>
<p>This isn&#8217;t a true cron job, with a crontab text file sitting on the server &#8211; it&#8217;s known as a pseudo-cron. Since a script can&#8217;t launch itself, it makes use of a visitor, human or maybe robot, launching it by requesting a page. So the job actually runs at the first launch <em>after</em> the scheduled time, not necessarily at the scheduled time to the exact second.</p>
<h3>wp_schedule_event()</h3>
<p>The most convenient way of using WP-Cron is to wrap it all up in a plugin &#8211; so that the scheduling can be done just the once by including it in the plugin activation function.</p>
<pre class="brush: php">
register_activation_hook(__FILE__, &#039;my_activation&#039;);
add_action(&#039;my_hourly_event&#039;, &#039;do_this_hourly&#039;);
register_deactivation_hook(__FILE__, &#039;my_deactivation&#039;); 

function my_activation() {
wp_schedule_event(time(), &#039;hourly&#039;, &#039;my_hourly_event&#039;);
}

function my_deactivation() {
	wp_clear_scheduled_hook(&#039;my_hourly_event&#039;);
}

function do_this_hourly() {
	// do something here every hour
}
</pre>
<p>The PHP time() used as an argument indicates &#8220;as of now&#8221; &#8211; so if the plugin is activated at 11:23, an hourly event is going to run at xx:23 from now onwards.</p>
<p>If your code is in for example <strong>functions.php</strong> and is executed every time the script is executed, you don&#8217;t want to keep scheduling the same event. Something like this prevents the problem:-</p>
<pre class="brush: php">
if (empty(wp_next_scheduled(&#039;my_event&#039;)))
		wp_schedule_event(time(), &#039;daily&#039;, &#039;my_event&#039;);
</pre>
<h3> WP-Cron Hourly, Recurrence Intervals</h3>
<p>Only <strong>hourly</strong>, <strong>daily</strong> and <strong>twicedaily</strong> are available immediately &#8211;  but there&#8217;s a trick to getting more and that&#8217;s to tap into the cron_schedules filter and add a key to the schedules array.</p>
<pre class="brush: php">
add_filter(&#039;cron_schedules&#039;, &#039;my_add_weekly&#039;);

function my_add_weekly( $schedules ) {
	$schedules[&#039;weekly&#039;] = array(
		&#039;interval&#039; =&gt; 604800, //that&#039;s how many seconds in a week, for the unix timestamp
		&#039;display&#039; =&gt; __(&#039;Once Weekly&#039;)
	);
	return $schedules;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/wp-cron-automating-scheduling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

