<?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>Roy Tanck's weblog &#187; Programming</title> <atom:link href="http://www.roytanck.com/category/programming/feed/" rel="self" type="application/rss+xml" /><link>http://www.roytanck.com</link> <description>Fascinated by new technology</description> <lastBuildDate>Thu, 09 Feb 2012 11:20:49 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>Getting my Flickr/Picasa widget working again with Picasa&#8217;s new feeds</title><link>http://www.roytanck.com/2011/03/04/getting-my-flickrpicasa-widget-working-again-with-picasas-new-feeds/</link> <comments>http://www.roytanck.com/2011/03/04/getting-my-flickrpicasa-widget-working-again-with-picasas-new-feeds/#comments</comments> <pubDate>Fri, 04 Mar 2011 12:01:48 +0000</pubDate> <dc:creator>Roy</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Web design]]></category> <category><![CDATA[Flickr]]></category> <category><![CDATA[http]]></category> <category><![CDATA[https]]></category> <category><![CDATA[Picasa]]></category> <category><![CDATA[RSS]]></category><guid isPermaLink="false">http://www.roytanck.com/?p=3006</guid> <description><![CDATA[TweetRecently, Picasa started serving its RSS feeds over https. From what I can tell, this has caused quite a view &#8220;clients&#8221; to fail. Digital photo frames seem to be affected, and so is my Flickr widget. Fortunately, there&#8217;s a quick fix. I&#8217;ve run a few tests, and it seems that simply removing the &#8220;s&#8221; from [...]]]></description> <content:encoded><![CDATA[<div id="tweetbutton3006" class="tw_button" style="float: right; margin: 0 0 0 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.roytanck.com%2F2011%2F03%2F04%2Fgetting-my-flickrpicasa-widget-working-again-with-picasas-new-feeds%2F&amp;via=roytanck&amp;text=Getting%20my%20Flickr%2FPicasa%20widget%20working%20again%20with%20Picasa%26%238217%3Bs%20new%20feeds&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.roytanck.com%2F2011%2F03%2F04%2Fgetting-my-flickrpicasa-widget-working-again-with-picasas-new-feeds%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.roytanck.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><img src="http://www.roytanck.com/wp-content/uploads/2011/03/picasa_logo-150x150.png" alt="" title="picasa logo" width="150" height="150" class="alignleft size-thumbnail wp-image-3009" />Recently, Picasa started serving its RSS feeds over <a href="http://en.wikipedia.org/wiki/Https">https</a>. From what I can tell, this has caused quite a view &#8220;clients&#8221; to fail. Digital photo frames seem to be affected, and so is my <a href="http://www.roytanck.com/get-my-flickr-widget/">Flickr widget</a>. Fortunately, there&#8217;s a quick fix.</p><p>I&#8217;ve run a few tests, and it seems that simply removing the &#8220;s&#8221; from &#8220;https&#8221; fixes the issue. Every feed I tried could be called up over regular old http as well, and all of them worked with my widget.<br /> <span id="more-3006"></span><br /> So if the RSS link in Picasaweb gives you an https feed URL like this one:</p><p><code><strong>https</strong>://picasaweb.google.com/data/feed/base/user/roy.tanck/albumid/5053904170293136801?alt=rss&#038;kind=photo&#038;hl=en_US</code></p><p>You should change it to this before entering it into the <a href="http://www.roytanck.com/get-my-flickr-widget/">form</a> that generates the widget:</p><p><code><strong>http</strong>://picasaweb.google.com/data/feed/base/user/roy.tanck/albumid/5053904170293136801?alt=rss&#038;kind=photo&#038;hl=en_US</code></p><p>As always, the preview will show you whether the feed works.</p> ]]></content:encoded> <wfw:commentRss>http://www.roytanck.com/2011/03/04/getting-my-flickrpicasa-widget-working-again-with-picasas-new-feeds/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>Erratic behavior with Flash&#8217;s textWidth property</title><link>http://www.roytanck.com/2010/11/25/erratic-behavior-with-flashs-textwidth-property/</link> <comments>http://www.roytanck.com/2010/11/25/erratic-behavior-with-flashs-textwidth-property/#comments</comments> <pubDate>Thu, 25 Nov 2010 11:21:53 +0000</pubDate> <dc:creator>Roy</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Flash]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Adobe]]></category> <category><![CDATA[bug]]></category> <category><![CDATA[typography]]></category><guid isPermaLink="false">http://www.roytanck.com/?p=2885</guid> <description><![CDATA[TweetJust a quick post in case anyone else ever runs into this and manages to find their way to my blog. I just came across this in a client project I&#8217;m working on. I was using a TextField in Flash CS5, and needed to know the width of the actual text inside it for positioning [...]]]></description> <content:encoded><![CDATA[<div id="tweetbutton2885" class="tw_button" style="float: right; margin: 0 0 0 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.roytanck.com%2F2010%2F11%2F25%2Ferratic-behavior-with-flashs-textwidth-property%2F&amp;via=roytanck&amp;text=Erratic%20behavior%20with%20Flash%26%238217%3Bs%20textWidth%20property&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.roytanck.com%2F2010%2F11%2F25%2Ferratic-behavior-with-flashs-textwidth-property%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.roytanck.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><img src="http://www.roytanck.com/wp-content/uploads/2010/11/flash-cs5-logo-150x142.png" alt="" title="Adobe Flash CS5 logo" width="150" height="142" class="alignleft size-thumbnail wp-image-2888" />Just a quick post in case anyone else ever runs into this and manages to find their way to my blog.</p><p>I just came across this in a client project I&#8217;m working on. I was using a TextField in Flash CS5, and needed to know the width of the actual text inside it for positioning purposes. What I found was that in about 50% of cases, the <strong>textWidth property would return zero instead of the strings length in pixels</strong>. I tried using autoSize on the TextField and found that it would shorten half of its instances to a single character or less, causing the rest of the line to be invisible.</p><p>At first I thought there was something wrong with the font file, but the same happened with Verdana. So I started randomly changing settings, and it turns out that <strong>the &#8220;anti-alias for readability&#8221; setting was causing this</strong>. As soon as I changed that setting to &#8220;anti-alias for readability&#8221; the textfields were being autosized properly, and reported their actual lengths through the textWidth property.<br /> <span id="more-2885"></span><br /> I didn&#8217;t really investigate this any further once I found out this workaround. In fact, I needed to use &#8220;anti-alias for animation&#8221; anyway in my project. Please feel free to comment if this has happened to you, and/or you have more details about this strange little bug.</p> ]]></content:encoded> <wfw:commentRss>http://www.roytanck.com/2010/11/25/erratic-behavior-with-flashs-textwidth-property/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>bbAggregate lets you mix and match WordPress content</title><link>http://www.roytanck.com/2010/09/30/bbaggregate-lets-you-mix-and-match-wordpress-content/</link> <comments>http://www.roytanck.com/2010/09/30/bbaggregate-lets-you-mix-and-match-wordpress-content/#comments</comments> <pubDate>Thu, 30 Sep 2010 13:38:26 +0000</pubDate> <dc:creator>Roy</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[WordPress plugins]]></category> <category><![CDATA[aggregation]]></category> <category><![CDATA[bbAggregate]]></category> <category><![CDATA[Bjorn Wijers]]></category> <category><![CDATA[burobjorn]]></category> <category><![CDATA[multisite]]></category> <category><![CDATA[plugin]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WPMU]]></category><guid isPermaLink="false">http://www.roytanck.com/?p=2801</guid> <description><![CDATA[TweetWhen I first started using WPMU, the now-integrated multisite version of WordPress, I found it strange that there were no built-in tools to aggregate content onto the main blog. It seemed to me that that was something plenty of people would want to do. Sure, there were plugins and hacks, but none of them were [...]]]></description> <content:encoded><![CDATA[<div id="tweetbutton2801" class="tw_button" style="float: right; margin: 0 0 0 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.roytanck.com%2F2010%2F09%2F30%2Fbbaggregate-lets-you-mix-and-match-wordpress-content%2F&amp;via=roytanck&amp;text=bbAggregate%20lets%20you%20mix%20and%20match%20WordPress%20content&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.roytanck.com%2F2010%2F09%2F30%2Fbbaggregate-lets-you-mix-and-match-wordpress-content%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.roytanck.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><img src="http://www.roytanck.com/wp-content/uploads/2010/09/bbaggregate.png" alt="" title="bbAggregate screenshot" width="279" height="237" class="alignleft size-full wp-image-2804" />When I first started using WPMU, the now-integrated multisite version of WordPress, I found it strange that there were no built-in tools to aggregate content onto the main blog. It seemed to me that that was something plenty of people would want to do. Sure, there were plugins and hacks, but none of them were as polished as I&#8217;d like them to be.</p><p>Fortunately, things have changed. WordPress 3.0 now has multisite capabilities built right into it, and <a href="http://www.burobjorn.nl">Bjorn Wijers</a>, a friend of mine and one of Holland&#8217;s top WordPress developers, has created a really cool plugin to handle content aggregation. Called <a href="http://wordpress.org/extend/plugins/bbaggregate/">bbAggregate</a>, this plugin doesn&#8217;t just collect posts from blogs to be displayed on the home page, it allows you to display aggregated content on <strong>any</strong> of your network&#8217;s blogs. And to do this it introduces the concept of streams.<br /> <span id="more-2801"></span></p><h2>Streams</h2><p>Once installed, bbAggregate will allow you to create and manage so-called &#8220;streams&#8221; of content. If there are multiple bloggers in your network who write about cats, you could set up a stream called &#8220;cats&#8221;. Post authors would ten be able to add posts they write to the &#8220;cats&#8221; stream. At the same time, they can choose to show the &#8220;cats&#8221; stream on their blog. If others blog about dogs, setting up a &#8220;dogs&#8221; and a &#8220;pets&#8221; stream makes sense. It may help to think of streams as a type of category, but there&#8217;s a little more to it than that.</p><p><img src="http://www.roytanck.com/wp-content/uploads/2010/09/bbaggregate-screenshot.png" alt="" title="bbaggregate screenshot" width="590" height="592" class="alignnone size-full wp-image-2809" /></p><h2>Control</h2><p>Unlike with (site-wide) categories, bbAggregate offers fine-grained control over what is shown in a stream. You can exclude blogs, limit the number of posts per blog and set up pagination. There&#8217;s no per-post control over what is in the stream (other than by editing that post, if you have the right privileges), but the plugin makes it very easy to exclude blogs that don&#8217;t play nice.</p><h2>Room for improvement</h2><p>This is a brand new plugin. Considering how complex the underlying code must be, the currently released version is very mature. However, there are a few things I think could be improved. The main one is that in order to display a stream, some theme editing is required. This is a well-documented and easy process, but I&#8217;d love to see a more seamless integration in future versions. I&#8217;m pretty sure this can be done, and it would greatly improve the project&#8217;s change of being widely adopted.</p><p>If you&#8217;re looking for a flexible way to cross-aggregate posts on your multisite WordPress install, I&#8217;d highly recommended checking out <a href="http://wordpress.org/extend/plugins/bbaggregate/">bbAggregate</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.roytanck.com/2010/09/30/bbaggregate-lets-you-mix-and-match-wordpress-content/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>iBubble Shooter now has nag screens, but can you really blame Absolutist?</title><link>http://www.roytanck.com/2010/09/27/ibubble-shooter-now-has-nag-screens-but-can-you-really-blame-absolutist/</link> <comments>http://www.roytanck.com/2010/09/27/ibubble-shooter-now-has-nag-screens-but-can-you-really-blame-absolutist/#comments</comments> <pubDate>Mon, 27 Sep 2010 17:25:26 +0000</pubDate> <dc:creator>Roy</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Absolutists]]></category> <category><![CDATA[App Store]]></category> <category><![CDATA[demo]]></category> <category><![CDATA[free]]></category> <category><![CDATA[game]]></category> <category><![CDATA[iBubble Shooter]]></category> <category><![CDATA[iOS]]></category> <category><![CDATA[iPhone]]></category> <category><![CDATA[iPod]]></category> <category><![CDATA[nag screens]]></category> <category><![CDATA[pro]]></category><guid isPermaLink="false">http://www.roytanck.com/?p=2797</guid> <description><![CDATA[TweetDon&#8217;t get me wrong. I hate nag screens as much as anyone, but after playing the free version of iBubble Shooter for quite some time I&#8217;m can&#8217;t really blame them for trying to get me to upgrade. The game is based on the classic bust-a-move principle, in which you shoot bubbles from the bottom of [...]]]></description> <content:encoded><![CDATA[<div id="tweetbutton2797" class="tw_button" style="float: right; margin: 0 0 0 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.roytanck.com%2F2010%2F09%2F27%2Fibubble-shooter-now-has-nag-screens-but-can-you-really-blame-absolutist%2F&amp;via=roytanck&amp;text=iBubble%20Shooter%20now%20has%20nag%20screens%2C%20but%20can%20you%20really%20blame%20Absolutist%3F&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.roytanck.com%2F2010%2F09%2F27%2Fibubble-shooter-now-has-nag-screens-but-can-you-really-blame-absolutist%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.roytanck.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><img src="http://www.roytanck.com/wp-content/uploads/2010/09/ibubble-shooter-240x160.jpg" alt="" title="ibubble shooter" width="240" height="160" class="alignleft size-medium wp-image-2798" />Don&#8217;t get me wrong. I hate nag screens as much as anyone, but after playing the free version of iBubble Shooter for quite some time I&#8217;m can&#8217;t really blame them for trying to get me to upgrade. The game is based on the classic bust-a-move principle, in which you shoot bubbles from the bottom of the screen trying to group them together based on color. It&#8217;s pretty good, certainly the best touch screen translation of the concept that I&#8217;ve played. At € 0.80 it&#8217;s a steal. But that was even more true for the original free version.<br /> <span id="more-2797"></span><br /> What Absolutist, who made the game, probably shouldn&#8217;t have done was create a free version that allowed you to fully play the game. Up until a few days ago, there was very little reason to buy the &#8216;pro&#8217; version. Other than being able to save your game and return to it later, it offered very little over the free one. The nag screens in the new version fix that, but it feels like Absolutist has taken something away from me. They&#8217;ve made my experience worse.</p><p>I guess this is a good case study for iPhone app developers. If you&#8217;re planning to make money off of your app, you should probably limit the free/demo version right off the bat. You can always remove or relax limits, but adding them later won&#8217;t earn you any points with users. And if your app is as good as this one, I&#8217;d recommend pricing the pro version a little higher.</p> ]]></content:encoded> <wfw:commentRss>http://www.roytanck.com/2010/09/27/ibubble-shooter-now-has-nag-screens-but-can-you-really-blame-absolutist/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Creating a split menu in WordPress 3.0</title><link>http://www.roytanck.com/2010/09/16/creating-a-split-menu-in-wordpress-3-0/</link> <comments>http://www.roytanck.com/2010/09/16/creating-a-split-menu-in-wordpress-3-0/#comments</comments> <pubDate>Thu, 16 Sep 2010 13:26:40 +0000</pubDate> <dc:creator>Roy</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[WordPress themes]]></category> <category><![CDATA[categories]]></category> <category><![CDATA[code]]></category> <category><![CDATA[development]]></category> <category><![CDATA[menus]]></category> <category><![CDATA[pages]]></category> <category><![CDATA[parent]]></category> <category><![CDATA[WordPress]]></category><guid isPermaLink="false">http://www.roytanck.com/?p=2766</guid> <description><![CDATA[TweetFor a project I&#8217;m working on, I needed to create a split menu, where the top level navigation was in a horizontal menu in the header, with all underlying content listed elsewhere on the page. This turned out to be a little harder than I had anticipated, but I managed to get it working. Here&#8217;s [...]]]></description> <content:encoded><![CDATA[<div id="tweetbutton2766" class="tw_button" style="float: right; margin: 0 0 0 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.roytanck.com%2F2010%2F09%2F16%2Fcreating-a-split-menu-in-wordpress-3-0%2F&amp;via=roytanck&amp;text=Creating%20a%20split%20menu%20in%20WordPress%203.0&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.roytanck.com%2F2010%2F09%2F16%2Fcreating-a-split-menu-in-wordpress-3-0%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.roytanck.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>For a project I&#8217;m working on, I needed to create a split menu, where the top level navigation was in a horizontal menu in the header, with all underlying content listed elsewhere on the page. This turned out to be a little harder than I had anticipated, but I managed to get it working. Here&#8217;s how I did it. Feel free to add suggestions in the comments if you see room for improvement.</p><p><img src="http://www.roytanck.com/wp-content/uploads/2010/09/splitmenu-layout-diagram.png" alt="" title="split menu layout" width="400" height="283" class="alignnone size-full wp-image-2770" /><br /> <span id="more-2766"></span></p><h2>The horizontal menu</h2><p>For the main menu (shown in red in the image above), I wanted to use <a href="http://codex.wordpress.org/Appearance_Menus_SubPanel">WordPress 3.0&#8242;s new &#8216;Menus&#8217; feature</a>. By doing so, my client has full control over the menu&#8217;s content. <a href="http://codex.wordpress.org/Navigation_Menus">Setting it up</a> is very easy to do, so I won&#8217;t bother explaining it here.</p><p>WordPress automatically adds CSS classes to the menu for selected items, so highlighting the current selection is very easy.</p><p><code><pre style="display: block; background-color: #eee; padding: 10px; border: 1px solid #ccc; margin-bottom: 30px;">
#mainmenu li.current-menu-item,
#mainmenu li.current-page-ancestor,
#mainmenu li.current-post-ancestor,
#mainmenu li.current-category-ancestor { background-color: #00f; }
</pre><p></code></p><h2>The sub menu</h2><p>The main issue with the secondary menu (light blue in the image) was figuring out what to display. It&#8217;s easy enough in WordPress to feed the current page&#8217;s ID number to the <a href="http://codex.wordpress.org/Function_Reference/wp_list_pages">wp_list_pages</a> function and get its children, but in this case, that&#8217;s not what I wanted. I needed to display the menu from the selected main menu item on down, even if the current page was nested four levels deep. So instead of using the current page&#8217;s ID, I needed to figure out the selected top level page, and use that page&#8217;s ID.</p><p><code><pre style="display: block; background-color: #eee; padding: 10px; border: 1px solid #ccc;">
function rt_getTopPageID( $page_ID ){
	$ancestors = get_post_ancestors($page_ID);
	if( !empty($ancestors) ){
		foreach( $ancestors as $ancestor ){
			$anc = get_post_ancestors($ancestor);
			if( empty($anc) ){ return $ancestor; }
		}
	}
	return $page_ID;
}
</pre><p></code></p><p>I added this function to my theme&#8217;s functions.php file. What it does is move up the page hierarchy step my step until it reaches the top page. It returns that page&#8217;s ID for use with wp_list_pages. I&#8217;m aware that this may be slow, but it&#8217;s the most efficient way I could find to get the top page.</p><p>On the sidebar, I used something like this to display the sub menu:</p><p><code><pre style="display: block; background-color: #eee; padding: 10px; border: 1px solid #ccc;">
global $wp_query;
$page_ID = $wp_query->post->ID;
$toppage = rt_getTopPageID( $page_ID );
wp_list_pages( 'title_li=&#038;child_of='.$toppage );
</pre><p></code></p><p>What this does is get the current page&#8217;s ID from the page query, and feed it to my rt_getTopPageID function. The returned ID is then used to call the correct menu.</p><h2>Categories</h2><p>I then needed to do the same for categories. I ended up creating a sidebar widget that, depending on the context, displayed the right menu. The widget is very specific to my project, but here&#8217;s the function it uses to get the top category.</p><p><code><pre style="display: block; background-color: #eee; padding: 10px; border: 1px solid #ccc;">
function rt_getTopCategoryID( $cat_ID ){
	$pathStr = get_category_parents( $cat_ID, false, '[#]', false );
	$pathArr = explode( '[#]', $pathStr );
	$cat = get_term_by( 'name', $pathArr[0], 'category' );
	return $cat->term_id;
}
</pre><p></code></p><p>This function uses a shortcut to get to the top level category. The <a href="http://codex.wordpress.org/Function_Reference/get_category_parents">get_category_parents</a> function returns a string with the full hierarchy, which we can then split. The first item in the resulting array is the top category&#8217;s name. Using <a href="http://codex.wordpress.org/Function_Reference/get_term_by">get_term_by</a>, we can then get that category&#8217;s ID. I&#8217;m assuming that this is lighter and quicker than trying to move up the hierarchy like I did with the pages.</p><p>The widget then uses this function to get the category structure. On category overview pages, I use this code.</p><p><code><pre style="display: block; background-color: #eee; padding: 10px; border: 1px solid #ccc;">
$cat_ID = get_query_var('cat');
$topCat = rt_getTopCategoryID( $cat_ID );
wp_list_categories( 'title_li=&#038;child_of='.$topCat );
</pre><p></code></p><p>On single post pages, This is what I currently use, but I&#8217;ll be the first to admit this needs work. Posts can be in many categories, which can result in all sorts of weirdness. Some editorial restraint will be in order for my client, but the principle works.</p><p><code><pre style="display: block; background-color: #eee; padding: 10px; border: 1px solid #ccc;">
global $post;
$categories = get_the_category($post->ID);
$topCat = rt_getTopCategoryID( $categories[0]->term_id );
wp_list_categories( 'title_li=&#038;child_of='.$topCat );
</pre><p></code></p><p>That&#8217;s it. My widget now shows the correct menu on single page, post and category pages. There&#8217;s probably some room left for improvement, so don&#8217;t be shy and comment away.</p> ]]></content:encoded> <wfw:commentRss>http://www.roytanck.com/2010/09/16/creating-a-split-menu-in-wordpress-3-0/feed/</wfw:commentRss> <slash:comments>21</slash:comments> </item> <item><title>Snapatar now uses oAuth (phew!)</title><link>http://www.roytanck.com/2010/08/18/snapatar-now-uses-oauth-phew/</link> <comments>http://www.roytanck.com/2010/08/18/snapatar-now-uses-oauth-phew/#comments</comments> <pubDate>Wed, 18 Aug 2010 10:01:27 +0000</pubDate> <dc:creator>Roy</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[avatar]]></category> <category><![CDATA[oAuth]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Snapatar]]></category> <category><![CDATA[Twitter]]></category> <category><![CDATA[twitter_async]]></category> <category><![CDATA[webcam]]></category><guid isPermaLink="false">http://www.roytanck.com/?p=2734</guid> <description><![CDATA[TweetAs some of you may know, Twitter is fading out support for &#8220;basic authentication&#8221;. This basically means that app developers (like myself) can&#8217;t just send a user&#8217;s login information to Twitter&#8217;s server when we want to send a tweet or change a setting. Instead the application needs to be &#8220;authorized&#8221; by the user using a [...]]]></description> <content:encoded><![CDATA[<div id="tweetbutton2734" class="tw_button" style="float: right; margin: 0 0 0 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.roytanck.com%2F2010%2F08%2F18%2Fsnapatar-now-uses-oauth-phew%2F&amp;via=roytanck&amp;text=Snapatar%20now%20uses%20oAuth%20%28phew%21%29&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.roytanck.com%2F2010%2F08%2F18%2Fsnapatar-now-uses-oauth-phew%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.roytanck.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><img src="http://www.roytanck.com/wp-content/uploads/2010/08/180px-Oauth_logo.png" alt="" title="180px-Oauth_logo" width="180" height="181" class="alignleft size-full wp-image-2735" />As some of you may know, Twitter is fading out support for &#8220;basic authentication&#8221;. This basically means that app developers (like myself) can&#8217;t just send a user&#8217;s login information to Twitter&#8217;s server when we want to send a tweet or change a setting. Instead the application needs to be &#8220;authorized&#8221; by the user using a process called <a href="http://en.wikipedia.org/wiki/OAuth">oAuth</a>.</p><p>For <a href="http://snapatar.com">Snapatar</a>, this meant I needed to make a lot of changes. OAuth is far from trivial to implement, and I was lucky to find a <a href="http://github.com/jmathai/twitter-async">library</a> that handles most of the complicated stuff. With it, I was able to get oAuth working on snapatar.com, and beat the August 16 deadline.<span id="more-2734"></span></p><p>Unfortunately, I messed up when I put the new version live. I forgot to update a setting in Twitter&#8217;s app registration system, causing the oAuth process to fail. But that has been fixed now, and you&#8217;re welcome to give the new authentication process a try. Currently, there&#8217;s absolutely no error handling, so you may run into an occasional poorly formatted error message if something failed. Most of the time however, it should just work.</p> ]]></content:encoded> <wfw:commentRss>http://www.roytanck.com/2010/08/18/snapatar-now-uses-oauth-phew/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>WP-Cumulus 2.0 is finally in development (again)</title><link>http://www.roytanck.com/2010/05/29/wp-cumulus-2-is-finally-in-development-again/</link> <comments>http://www.roytanck.com/2010/05/29/wp-cumulus-2-is-finally-in-development-again/#comments</comments> <pubDate>Sat, 29 May 2010 19:54:44 +0000</pubDate> <dc:creator>Roy</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress plugins]]></category> <category><![CDATA[Flash]]></category> <category><![CDATA[i18n]]></category> <category><![CDATA[plugin]]></category> <category><![CDATA[SWFObject]]></category> <category><![CDATA[tag cloud]]></category> <category><![CDATA[tags]]></category> <category><![CDATA[WP-Cumulus]]></category><guid isPermaLink="false">http://www.roytanck.com/?p=2678</guid> <description><![CDATA[TweetI&#8217;ve been promising a new version of WP-Cumulus for a long time. I&#8217;ve tried working with more experienced PHP developers, but it&#8217;s been hard to find a really good one who&#8217;s able to devote time to the project. I still think a plugin like this should be a team effort, but for now I&#8217;m going [...]]]></description> <content:encoded><![CDATA[<div id="tweetbutton2678" class="tw_button" style="float: right; margin: 0 0 0 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.roytanck.com%2F2010%2F05%2F29%2Fwp-cumulus-2-is-finally-in-development-again%2F&amp;via=roytanck&amp;text=WP-Cumulus%202.0%20is%20finally%20in%20development%20%28again%29&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.roytanck.com%2F2010%2F05%2F29%2Fwp-cumulus-2-is-finally-in-development-again%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.roytanck.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>I&#8217;ve been promising a new version of WP-Cumulus for a long time. I&#8217;ve tried working with more experienced PHP developers, but it&#8217;s been hard to find a really good one who&#8217;s able to devote time to the project. I still think a plugin like this should be a team effort, but for now I&#8217;m going to kick things back into motion again myself.</p><p>What&#8217;s ready at this point is a much cleaner rewrite of the plugin files, with the display logic in a neat little class that port authors will hopefully be able to reuse. I&#8217;ve also got a Flash movie that uses a user-defined system font, as a result is much smaller, and supports unicode tags.<br /> <span id="more-2678"></span></p><h2>Burning bridges</h2><p>I&#8217;ve decided to bump the required WordPress version to 2.8 or 2.9. There&#8217;s so much code in the current version that&#8217;s there only to support older versions and adds nothing. Running older WP versions is a bad idea anyway, and I want to use the new widget and option page APIs.</p><p>Another thing I consider a bad idea in hindsight is the &#8220;compatibility mode&#8221;. It way helpful for debugging WP-Cumulus on blogs with poor markup, but I&#8217;m going to trust that SWFObject 2.2 does a better job and once again skip all the extra code required.</p><p>Lastly, to support unicode, your blog&#8217;s visitors will need Flash Player 10.</p><h2>Security</h2><p>Now that I have the main two parts (plugin and Flash movie), I need to hook the two up to each other. The basic idea behind how WP-Cumulus works has always been that WordPress supplied the tags through its wp_tag_cloud function. It was easy and convenient to simply pass that function&#8217;s output through to the movie using the &#8220;flashvars&#8221; interface.</p><p>However, as some experts have found, the technique of passing URLs through flashvars, while extremely common among Flash programmers, poses a security risk. Versions 1.22 and 1.23 pathed the biggest holes, but there&#8217;s still a very eloborate social XSS that could pose a risk to Cumulus users. Another issue is that some themes alter the output of wp_tag_cloud through an API hook. This is fine for the html tag cloud, but for WP-Cumulus it means my Flash movie doesn&#8217;t get the data as it expects it.</p><p>This means I&#8217;ll have to rethink the flow of data, and as a result, the movie&#8217;s technical interface is going to be radically different. I&#8217;m thinking along the lines of having the movie request its content from a fixed, relative url, and using JSON instead of XML. I know this also affects the authors of ports to other systems, but my primary concern is the WordPress community.</p><h2>ASAP</h2><p>There are lots of things that still need to be done. Like i18n, the data interface and better alternate (&#8220;no-flash&#8221;) content. I&#8217;m really committed to getting a completely rewritten version of the plugin out there as soon as possible, but I also want to make sure it&#8217;s stable. Think weeks, at least. There&#8217;s not a single line of code in the new version that I copied from 1.23, so it&#8217;ll need extensive testing.</p> ]]></content:encoded> <wfw:commentRss>http://www.roytanck.com/2010/05/29/wp-cumulus-2-is-finally-in-development-again/feed/</wfw:commentRss> <slash:comments>51</slash:comments> </item> <item><title>Browsers are pretty quick at scaling images</title><link>http://www.roytanck.com/2010/03/26/browsers-are-pretty-quick-at-scaling-images/</link> <comments>http://www.roytanck.com/2010/03/26/browsers-are-pretty-quick-at-scaling-images/#comments</comments> <pubDate>Fri, 26 Mar 2010 13:57:29 +0000</pubDate> <dc:creator>Roy</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Web design]]></category> <category><![CDATA[browsers]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[images]]></category> <category><![CDATA[pixels]]></category> <category><![CDATA[scaling]]></category> <category><![CDATA[speed]]></category> <category><![CDATA[test]]></category> <category><![CDATA[web design]]></category><guid isPermaLink="false">http://www.roytanck.com/?p=2588</guid> <description><![CDATA[TweetI used to be a real nitpicker when it came to preparing images for the web. I&#8217;d laugh at people using large images in web pages, showing them in a smaller format by setting the width and height properties. In the days before broadband was everywhere it was bad karma to do this, because a [...]]]></description> <content:encoded><![CDATA[<div id="tweetbutton2588" class="tw_button" style="float: right; margin: 0 0 0 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.roytanck.com%2F2010%2F03%2F26%2Fbrowsers-are-pretty-quick-at-scaling-images%2F&amp;via=roytanck&amp;text=Browsers%20are%20pretty%20quick%20at%20scaling%20images&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.roytanck.com%2F2010%2F03%2F26%2Fbrowsers-are-pretty-quick-at-scaling-images%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.roytanck.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><img src="http://www.roytanck.com/wp-content/uploads/2010/03/mosiac-150x150.png" alt="" title="pixels" width="150" height="150" class="alignleft size-thumbnail wp-image-2589" />I used to be a real nitpicker when it came to preparing images for the web. I&#8217;d laugh at people using large images in web pages, showing them in a smaller format by setting the width and height properties.</p><p>In the days before broadband was everywhere it was bad karma to do this, because a large image file would take a long time to download. You needed to prepare the image at the size you were going to be displaying it. Nowadays, things are a little different.<br /> <span id="more-2588"></span><br /> A client asked me recently to propose a new layout for a page that had a fixed grid. Unfortunately, their CMS could was limited to a couple of image sizes that were a complete mismatch with said grid. So I used CSS scaling to get them to fit. Unfortunately, the client wasn&#8217;t convinced this was a feasible technique to use. That&#8217;s why I did a few quick tests to see if using scaled images in a web page would slow down rendering.</p><h2>A quick test</h2><p>I created a page with 150 random images on it. Fifty of them were 24bit PNGs, another fiftly were JPEG and the rest were 8 bit GIFs. Next, I created a copy of that page and set the CSS size properties for the images to a lower number, scaling all images to 61.5%. I then used Google&#8217;s <a href="https://chrome.google.com/extensions/detail/ognampngfcbddbfemdapefohjiobgbdl">Speed Tracer</a> extension for Chrome and Yahoo&#8217;s <a href="http://developer.yahoo.com/yslow/">YSlow</a> for Firefox to see if there would be any difference in page load and render times.</p><h2>No difference whatsoever</h2><p>The results were pretty clear. Even with 150 images on the page, there was absolutely no difference in page rendering times in Chrome. Both pages finished rendering in around 4:10 seconds. In Firefox, the results were much more erratic, but both pages averaged at around 6.5 second. In both cases I didn&#8217;t worry about caching, since I was interested in differences in rendering speed, not download speed.</p><p>So there you have it. It may still not be 100% good karma, but to overcome design obstacles, using client side scaling isn&#8217;t as bad as it used to be. If you need a few images to fit that you can&#8217;t prepare or resize on the server, you won&#8217;t have to worry about it slowing down your page. However, actually scaling an image usually makes the file smaller, so if you can you still should.</p> ]]></content:encoded> <wfw:commentRss>http://www.roytanck.com/2010/03/26/browsers-are-pretty-quick-at-scaling-images/feed/</wfw:commentRss> <slash:comments>14</slash:comments> </item> <item><title>My thoughts on Flash and the iPad</title><link>http://www.roytanck.com/2010/02/28/my-thoughts-on-flash-and-the-ipad/</link> <comments>http://www.roytanck.com/2010/02/28/my-thoughts-on-flash-and-the-ipad/#comments</comments> <pubDate>Sun, 28 Feb 2010 15:41:52 +0000</pubDate> <dc:creator>Roy</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Flash]]></category> <category><![CDATA[Gadgets]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Android]]></category> <category><![CDATA[Apple]]></category> <category><![CDATA[CPU]]></category> <category><![CDATA[criticism]]></category> <category><![CDATA[games]]></category> <category><![CDATA[GPU]]></category> <category><![CDATA[HTML5]]></category> <category><![CDATA[iPad]]></category> <category><![CDATA[iPhone]]></category> <category><![CDATA[iPhone OS]]></category> <category><![CDATA[open source]]></category> <category><![CDATA[performance]]></category> <category><![CDATA[plugin]]></category> <category><![CDATA[touchscreen]]></category> <category><![CDATA[video]]></category> <category><![CDATA[Windows]]></category><guid isPermaLink="false">http://www.roytanck.com/?p=2551</guid> <description><![CDATA[TweetThere&#8217;s been a lot of controversy over Apple&#8217;s decision to ban Flash (and Java for that matter) from the iPhone since the day it was released. Now, with the iPad about to hit retail, there&#8217;s been more debate on whether this was a technical decision or not, and whether it&#8217;s a severe limitation for the [...]]]></description> <content:encoded><![CDATA[<div id="tweetbutton2551" class="tw_button" style="float: right; margin: 0 0 0 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.roytanck.com%2F2010%2F02%2F28%2Fmy-thoughts-on-flash-and-the-ipad%2F&amp;via=roytanck&amp;text=My%20thoughts%20on%20Flash%20and%20the%20iPad&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.roytanck.com%2F2010%2F02%2F28%2Fmy-thoughts-on-flash-and-the-ipad%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.roytanck.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><img src="http://www.roytanck.com/wp-content/uploads/2010/02/flash-ipad-185x240.jpg" alt="" title="Flash iPad" width="185" height="240" class="alignleft size-medium wp-image-2554" />There&#8217;s been a lot of controversy over Apple&#8217;s decision to ban Flash (and Java for that matter) from the iPhone since the day it was released. Now, with the iPad about to hit retail, there&#8217;s been more debate on whether this was a technical decision or not, and whether it&#8217;s a severe limitation for the devices, or a blessing. Being both a Flash developer, an iPhone OS user an open source advocate, I thought I&#8217;d weigh in on the conversation.</p><p>Before I get started though, let me point out that I&#8217;m not a fan of Flash. I think it&#8217;s a real shame that there&#8217;s no open, official standard that lets web designers do the things Flash can. Adobe has the web in an awkward stranglehold right now, and I&#8217;d love to see that change. But the reality is that Flash is an integral part of the web today.<br /> <span id="more-2551"></span></p><h2>HTML5 isn&#8217;t an option just yet</h2><p>One of the main uses of Flash on the web is video. People keep forgetting however that Flash is also used extensively for other things. It is the only technology available today that allows you to scale, rotated and distort objects. It has a 3D engine (which admittedly isn&#8217;t used widely, yet) and it offers the most advanced controls over typography of any tool in a contemporary web designer&#8217;s toolbox.</p><p>Flash is used in product demos (360 views), simulations, games, data visualizations and many other areas where HTML falls short. Perhaps the upcoming release of HTML5 will allow designers to do the same things without Flash, but until HTML5-supporting browsers are widely adopted, Flash is the (only) way to go. Especially since most of the HTML5 demos I&#8217;ve seen have been built using browser-specific (non-standard) functions and were nowhere near a smooth as Flash animation has been since 1996.</p><p>And as for video, HTML5 <a href="http://www.sitepoint.com/blogs/2010/01/25/the-dark-side-of-html-5-video/">appears to have a long way to go</a> before it can replace Flash as the web&#8217;s preferred video player.</p><h2>There&#8217;s no fundamental issue with Flash and touchscreens</h2><p><a href="http://www.roughlydrafted.com/2010/02/20/an-adobe-flash-developer-on-why-the-ipad-cant-use-flash/">This blog post</a> has been getting a lot of attention, and rightfully so. It clearly describes why some currently available Flash content won&#8217;t work very well on touchscreen devices like the iPad. However, the types of applications that Flash is often used for, especially games, have always needed different approaches for mouse pointer based devices and touchscreens. Whether they were developed using Flash or not. Flash allows you to accommodate both interaction models, and it&#8217;s no problem at all to create touchscreen interfaces in Flash.</p><h2>Flash is not buggy, slow or overly power-hungry on other devices</h2><p>Steve Jobs himself has <a href="http://www.techdigest.tv/2010/02/steve_jobs_flas.html">said</a> that Flash on the iPad would kill its battery life. And I&#8217;m sure it could. It&#8217;s very easy to create a Flash movie that uses every single CPU cycle available on whatever machine it runs on. But like with all other development platforms, that&#8217;s just bad programming. Flash is capable of techniques like bitmap caching which can reduce CPU utilization dramatically. And the soon to be released 10.1 version will be capable of outsourcing most of the remaining heavy work, like decoding video, to the systems GPU. Which is probably what the iPhone&#8217;s video player does too.</p><p>I&#8217;ll admit that the current Flash player is slow (by comparison to Windows) on OSX and Linux. It&#8217;s obvious that Adobe has not always maintained these players very well. There&#8217;s been debate over whether or not Apple is partly to blame for this, but fact is that the Mac version uses ten times the resources the Windows version needs to display the same content.</p><p>That being said, on ARM based sytems (like the iPhone and the iPad), things <a href="http://www.flashmobileblog.com/2010/02/24/battery-performance-with-flash-player-10-1-on-nexus-one/">aren&#8217;t quite so bad</a>. I get the feeling that many of the users commenting negatively about Flash as a technology are Apple fans who&#8217;ve not been getting the performance and stability that Flash delivers on Windows.</p><h2>A business decision?</h2><p>I&#8217;m convinced that Apple&#8217;s ban on Flash is purely a business decision. Allowing Adobe&#8217;s technology onto their devices would in turn allow content (music, video, games, etc) to be delivered to the devices without going through Apple&#8217;s immensely successful App Store. No matter how much Adobe would improve Flash&#8217;s performance and stability, it still wouldn&#8217;t make sense for Apple to change their minds. Not with <a href="http://www.apple.com/pr/library/2010/02/25itunes.html">billions of dollars</a> <a href="http://online.wsj.com/article/SB121842341491928977.html">coming in</a>.</p><p>On a side note, Adobe has announced that the next major version of the Flash development environment will allow Flash applications to be <a href="http://labs.adobe.com/technologies/flashcs5/appsfor_iphone/">exported as iPhone apps</a>. So there will be Flash on the iPhone, just not in web pages. For me, the most interesting thing about this is that it will reveal whether Flash is really as bad as Jobs says. I wonder if those apps will drain battery life and crash frequently. If they don&#8217;t, that will tell us a great deal about Apple, won&#8217;t it?</p><p>(Read this post in <a href="http://pc.de/pages/my-thoughts-on-flash-and-the-ipad-be" rel="nofollow">Belorussian</a> at <a href="http://pc.de/" rel="nofollow">PC</a>)</p> ]]></content:encoded> <wfw:commentRss>http://www.roytanck.com/2010/02/28/my-thoughts-on-flash-and-the-ipad/feed/</wfw:commentRss> <slash:comments>22</slash:comments> </item> <item><title>How to show each post&#8217;s date in WordPress</title><link>http://www.roytanck.com/2009/12/17/how-to-show-each-posts-date-in-wordpress/</link> <comments>http://www.roytanck.com/2009/12/17/how-to-show-each-posts-date-in-wordpress/#comments</comments> <pubDate>Thu, 17 Dec 2009 14:45:50 +0000</pubDate> <dc:creator>Roy</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress themes]]></category> <category><![CDATA[blogging]]></category> <category><![CDATA[fix]]></category> <category><![CDATA[template tags]]></category> <category><![CDATA[themes]]></category> <category><![CDATA[the_date]]></category> <category><![CDATA[the_time]]></category><guid isPermaLink="false">http://www.roytanck.com/?p=2430</guid> <description><![CDATA[TweetThe templating system in WordPress is very flexible, and there&#8217;s rarely something you can&#8217;t do or that doesn&#8217;t work as you&#8217;d expect. A notable exception however is the_date. Its purpose is simple enough. It displays the current post&#8217;s date of creation. But on pages with more than one post (such as on many blog home [...]]]></description> <content:encoded><![CDATA[<div id="tweetbutton2430" class="tw_button" style="float: right; margin: 0 0 0 10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.roytanck.com%2F2009%2F12%2F17%2Fhow-to-show-each-posts-date-in-wordpress%2F&amp;via=roytanck&amp;text=How%20to%20show%20each%20post%26%238217%3Bs%20date%20in%20WordPress&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.roytanck.com%2F2009%2F12%2F17%2Fhow-to-show-each-posts-date-in-wordpress%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.roytanck.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><img src="http://www.roytanck.com/wp-content/uploads/2009/12/clock-150x150.jpg" alt="clock" title="clock" width="150" height="150" class="alignleft size-thumbnail wp-image-2432" />The templating system in WordPress is very flexible, and there&#8217;s rarely something you can&#8217;t do or that doesn&#8217;t work as you&#8217;d expect. A notable exception however is <a href="http://codex.wordpress.org/Template_Tags/the_date"><code>the_date</code></a>. Its purpose is simple enough. It displays the current post&#8217;s date of creation. But on pages with more than one post (such as on many blog home pages), something weird happens. If a number of posts on any given page were created on the same date, <code>the_date</code> will only show that date for the first of those posts.</p><p>In the early days of blogging, posts were usually listed by date, much like a regular, paper diary. In the old default theme that comes with WordPress a big date title is used to separate posts into days. That&#8217;s what <code>the_date</code> was created to do, and so it makes sense it only displays the same date once. In most modern themes however, people like the date to be among the meta data for each article, so <code>the_date</code> falls short.<br /> <span id="more-2430"></span></p><h2>the_time</h2><p>In comes <code>the_time</code>. This template tag, as the name suggests, shows the time at which a post was created. However, it accepts a <a href="http://codex.wordpress.org/Formatting_Date_and_Time">PHP time format string</a> as an argument, and can be made to display the date. You could simply put a date formatting string in there and be done with it, but I like to keep things flexible, so i wanted to use the date format string set in WordPress&#8217; settings. That way the user controls the output, and it can be adjusted to international preferences.</p><p>When I first ran into this I posted my issue on the WordPress forums, and <a href="http://ottodestruct.com/blog/">Otto42</a> came up with a prefect solution. I&#8217;ve been using it ever since and thought I&#8217;d share it here.</p><p><code>the_time(get_option('date_format'));</code></p><p>What this does is get the user-set date format from WordPress and feed it to the_time. Since that function doesn&#8217;t have a &#8216;once a day&#8217; limitation, you can use this as often as you like in your theme.</p> ]]></content:encoded> <wfw:commentRss>http://www.roytanck.com/2009/12/17/how-to-show-each-posts-date-in-wordpress/feed/</wfw:commentRss> <slash:comments>36</slash:comments> </item> </channel> </rss>
