<?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>Keetee &#187; archives</title>
	<atom:link href="http://www.keetee.com/tag/archives/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.keetee.com</link>
	<description>My brain to your browser.</description>
	<lastBuildDate>Tue, 16 Mar 2010 21:14:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress: How to Customize the Date Format for wp_get_archives</title>
		<link>http://www.keetee.com/how-to-customize-the-date-format-for-wp_get_archives/</link>
		<comments>http://www.keetee.com/how-to-customize-the-date-format-for-wp_get_archives/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 16:15:18 +0000</pubDate>
		<dc:creator>Allison House</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[archives]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp_get_archives]]></category>

		<guid isPermaLink="false">http://www.keetee.com/?p=1032</guid>
		<description><![CDATA[The <a href="http://codex.wordpress.org/Template_Tags/wp_get_archives">wp_get_archives template tag</a> is one you've likely seen before&#8212;it displays date-based archives in a list much like what you see in my sidebar under "Explore." Surprisingly, the parameters accepted for this tag allow no changes in the date format.]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://codex.wordpress.org/Template_Tags/wp_get_archives">wp_get_archives template tag</a> is one you&#8217;ve likely seen before&mdash;it displays date-based archives in a list much like what you see in my sidebar under &#8220;Explore.&#8221; Surprisingly, the parameters accepted for this tag allow no changes in the date format.</p>
<p>It&#8217;s difficult to customize this right from your theme, and I suspect that&#8217;s why I was unable to locate any flexible solutions through the Wordpress forums or Google. The easiest way is to edit the original function itself. <strong>Be warned</strong>: new Wordpress installations will overwrite this fix.</p>
<p><span id="more-1032"></span><br />
<h4>Locate general-template.php</h4>
<p>Open the <strong>wp-includes</strong> folder from the root of your Wordpress install. Open the file <strong>general-template.php</strong> with a text editor and locate the wp_get_archives function. Find the following line:<br />
&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>820
821
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s %2$d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$wp_locale</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_month</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">month</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">year</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<p>In Wordpress 2.8.4 this is on line 820. The default date format is the full textual representation of the month and the full year. Example: <em>January 2009</em>.</p>
<h4>Alternative Date Formats</h4>
<h5>Short textual representation of month</h5>
<p>Example: <em>Jan 2009</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>820
821
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s %2$d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$wp_locale</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_month_abbrev</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_locale</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_month</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">month</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">year</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<h5>Numeric representation of month with leading zero</h5>
<p>Example: <em>01 2009</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>820
821
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s %2$d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> zeroise<span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">month</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">year</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<h5>Numeric representation of month, no leading zero</h5>
<p>Example: <em>1 2009</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>820
821
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$d %2$d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">month</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">year</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<h5>Two digit representation of year</h5>
<p>Example: <em>January 09</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>820
821
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s %2$s'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$wp_locale</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_month</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">month</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">year</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<h4>Adding Flourishes and Changing Order</h4>
<p>Additional formatting can be applied by just changing <strong>&#8216;%1$s %2$d&#8217;</strong> in that line, where <strong>%1$s</strong> represents the month and <strong>%2$d</strong> represents the year.</p>
<h5>Punctuation between month and year</h5>
<p>These examples use a slash. Replace with dot or dash as desired.</p>
<p>Example: <em>01/2009</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>820
821
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s/%2$d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> zeroise<span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">month</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">year</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<p>Example: <em>01/09</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>820
821
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s/%2$d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> zeroise<span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">month</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">year</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<h5>Abbreviated Year</h5>
<p>Example: <em>January &#8216;09</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>820
821
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s /'</span><span style="color: #339933;">%</span><span style="color:#800080;">2</span><span style="color: #000088;">$s</span><span style="color: #0000ff;">'), $wp_locale-&gt;get_month($arcresult-&gt;month), substr($arcresult-&gt;year, 2));
//</span></pre></td></tr></table></div>

<h5>Reversed Month and Year</h5>
<p>Example: <em>2009 January</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>820
821
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%2$d %1$s'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$wp_locale</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_month</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">month</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arcresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">year</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<h4>Mix, Match, Enjoy!</h4>
<p>There are more combinations than I can reasonably post here, but I hope this helps you figure out how to get the exact date format you want.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keetee.com/how-to-customize-the-date-format-for-wp_get_archives/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
