<?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>Pressed Words &#187; archives</title>
	<atom:link href="http://pressedwords.com/tag/archives/feed/" rel="self" type="application/rss+xml" />
	<link>http://pressedwords.com</link>
	<description>News and commentary about all things WordPress</description>
	<lastBuildDate>Thu, 11 Jun 2009 03:54:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1</generator>
	<item>
		<title>Monthly Archives Idea</title>
		<link>http://pressedwords.com/tabular-wordpress-archives/</link>
		<comments>http://pressedwords.com/tabular-wordpress-archives/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 00:05:22 +0000</pubDate>
		<dc:creator><![CDATA[Austin Matzko]]></dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[archives]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://pressedwords.com/?p=124</guid>
		<description><![CDATA[Charles Stricklin, WordPress Podcast guru, had an interesting idea for arranging monthly WordPress archives, which is basically to make an archives page like this.]]></description>
				<content:encoded><![CDATA[<p>Charles Stricklin, WordPress Podcast guru, <a href="http://charlesstricklin.com/2008/11/12/crafting-a-different-archives-template/">had an interesting idea for arranging monthly WordPress archives</a>, which is basically to make an archives page like this:</p>
<table>
<tbody>
<tr>
<th>2005</th>
<td><a href=""/></td>
<td><a href="http://www.example.com/2005/02/">Feb</a></td>
<td><a href=""/></td>
<td><a href="http://www.example.com/2005/04/">Apr</a></td>
<td><a href=""/></td>
<td><a href="http://www.example.com/2005/06/">Jun</a></td>
<td><a href="http://www.example.com/2005/07/">Jul</a></td>
<td><a href="http://www.example.com/2005/08/">Aug</a></td>
<td><a href="http://www.example.com/2005/09/">Sep</a></td>
<td><a href="http://www.example.com/2005/10/">Oct</a></td>
<td><a href="http://www.example.com/2005/11/">Nov</a></td>
<td><a href="http://www.example.com/2005/12/">Dec</a></td>
</tr>
<tr>
<th>2006</th>
<td><a href="http://www.example.com/2006/01/">Jan</a></td>
<td><a href="http://www.example.com/2006/02/">Feb</a></td>
<td><a href="http://www.example.com/2006/03/">Mar</a></td>
<td><a href="http://www.example.com/2006/04/">Apr</a></td>
<td><a href="http://www.example.com/2006/05/">May</a></td>
<td><a href="http://www.example.com/2006/06/">Jun</a></td>
<td><a href="http://www.example.com/2006/07/">Jul</a></td>
<td><a href="http://www.example.com/2006/08/">Aug</a></td>
<td><a href="http://www.example.com/2006/09/">Sep</a></td>
<td><a href="http://www.example.com/2006/10/">Oct</a></td>
<td><a href="http://www.example.com/2006/11/">Nov</a></td>
<td><a href=""/></td>
</tr>
<tr>
<th>2007</th>
<td><a href="http://www.example.com/2007/01/">Jan</a></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href=""/></td>
</tr>
<tr>
<th>2008</th>
<td><a href="http://www.example.com/2008/01/">Jan</a></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href="http://www.example.com/2008/04/">Apr</a></td>
<td><a href=""/></td>
<td><a href="http://www.example.com/2008/06/">Jun</a></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href=""/></td>
<td><a href="http://www.example.com/2008/10/">Oct</a></td>
<td><a href=""/></td>
<td><a href=""/></td>
</tr>
</tbody>
</table>
<p>Here&#8217;s how to do it just using the WordPress API (instead of direct database queries):</p>
<pre>
&lt;?php
if ( ! $calendar = wp_cache_get(&#39;year_month_archive&#39;, &#39;archive&#39;) ) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$calendar = array();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$year = date(&#39;Y&#39;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$mo_qry = new WP_Query();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$yr_qry = new WP_Query();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$yr_qry-&gt;query(array(&#39;year&#39; =&gt; $year, &#39;showposts&#39; =&gt; 1));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( $yr_qry-&gt;have_posts() ) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for ( $m = 1; $m &lt;= 12; $m++ ) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$mo_qry-&gt;query(array(&#39;year&#39; =&gt; $year, &#39;monthnum&#39; =&gt; $m, &#39;showposts&#39; =&gt; 1));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( $mo_qry-&gt;have_posts() ) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$calendar[$year][$m] = array(date(&#39;M&#39;, mktime(1,1,1, $m, 1, $year)), get_month_link($year, $m));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$calendar[$year][$m] = array(&#39;&#39;,&#39;&#39;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$year = intval($year - 1);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} while ( $yr_qry-&gt;have_posts() );
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ksort($calendar);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wp_cache_set(&#39;year_month_archive&#39;, $calendar, &#39;archive&#39;);
}
?&gt;
&lt;table&gt;
&lt;?php foreach( $calendar as $year =&gt; $m ) : ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;&lt;th&gt;&lt;?php echo $year; ?&gt;&lt;/th&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php foreach( $m as $data ) : ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;&lt;a href="&lt;?php echo $data[1]; ?&gt;"&gt;&lt;?php echo $data[0]; ?&gt;&lt;/a&gt;&lt;/td&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php endforeach; ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;
&lt;?php endforeach; ?&gt;
&lt;/table&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://pressedwords.com/tabular-wordpress-archives/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 1/8 queries in 0.004 seconds using memcached
Object Caching 231/244 objects using memcached

 Served from: pressedwords.com @ 2026-04-14 20:36:25 by W3 Total Cache -->