<?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>Photography and Wordpress, CSS, PHP, Photoshop and Dreamweaver Tutorials by Chase Adams &#187; PHP</title>
	<atom:link href="http://www.chaseadamsphotography.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chaseadamsphotography.com</link>
	<description>photography, php, css, chase adams, xhtml, tutorial, photoshop, wordpress</description>
	<lastBuildDate>Mon, 03 May 2010 20:54:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Use CSS and PHP to replace text dates in Wordpress with Calendar Images</title>
		<link>http://www.chaseadamsphotography.com/2009/09/07/completely-replace-your-text-dates-in-wordpress-with-images-2/</link>
		<comments>http://www.chaseadamsphotography.com/2009/09/07/completely-replace-your-text-dates-in-wordpress-with-images-2/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 21:16:25 +0000</pubDate>
		<dc:creator>chase_adams</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[css image replacement]]></category>
		<category><![CDATA[dates]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.chaseadamsphotography.com/wp/?p=455</guid>
		<description><![CDATA[A tutorial on how to use CSS &#38; PHP to call the_time to create a CSS class, and replace it with a Month &#38; Date image using sprite-technology.]]></description>
			<content:encoded><![CDATA[<p>
I know what you&#8217;re thinking to yourself: &#8220;Why would I want my Wordpress posts date to be completely replaced by images.&#8221;<br />
<br />
Just kidding. I don&#8217;t know why you would think that to yourself. Let&#8217;s face it, with the advent of CSS, we&#8217;ve all resorted to replacing what would be normal text markup (words on the page) with images because as designers and creatures of aesthetics, we like things to look unique&#8230;and there&#8217;s only so much uniqu-ity you can show with standard HTML.<br />
<br />
So I&#8217;ve taken the already available features of PHP in Wordpress and used it in conjunction with CSS to make totally replaced (and web-standards compliant) dates.<br />
<br /><span id="more-502"></span><br />
<em>Seem like a lot? See the note at the bottom or click <a href="#note">here!</a></em><br />
Here is an example if you haven&#8217;t already noticed it on the current post.<br />
<a href="http://www.chaseadamsphotography.com/wp/wp-content/uploads/2009/09/Screen-shot-2009-09-07-at-4.06.01-PM.png"><img src="http://www.chaseadamsphotography.com/wp/wp-content/uploads/2009/09/Screen-shot-2009-09-07-at-4.06.01-PM.png" alt="date replacement technique with PHP &amp; CSS" title="date replacement technique with PHP &amp; CSS" width="600" height="192" class="size-full wp-image-456" /></a><br />
<br />
Okay, here we go&#8230;Dive in with me. The water is warm. Download this <a href="http://www.chaseadamsphotography.com/wp/wp-content/uploads/2009/09/date_replace_toot/">folder</a> first. It contains 3 important files:
<ol>
<li>The PSD File with the calendar &#8220;pages&#8221; on it</li>
<li>The PHP</li>
<li>The CSS</li>
</ol>
<p>
You&#8217;ll also need to get the font &#8220;Downcome&#8221; if you want to keep the font of the Months &#038; Dates the same.</p>
<ol>
<li>First things first, you need to make the calendar. I&#8217;ve included a support folder with a PSD file called &#8220;datecolumns.psd&#8221;. You&#8217;re welcome to make any adjustments to it that you&#8217;d like, use it as is or completely wipe it clean and make your own, just remember that later on you&#8217;ll have to figure out your own background-positions.</li>
<li>Second, we need to create an unordered list in the <strong>index.php</strong> of your site. We&#8217;re going to do something like this:
<pre>
<ul width="500px">
<li>&lt;ul class="smallentrydate"&gt;</li>
<li>&lt;li class="class="date&lt;?php the_time('M'); ?&gt;"&gt;

&lt;a&gt;

&lt;?php the_time('M'); ?&gt;

&lt;?php the_time('d'); ?&gt;,

&lt;?php the_time('Y'); ?&gt;

&lt;/a&gt;

&lt;/li&gt;</li>
<li>&lt;li class="date&lt;?php the_time('d'); ?&gt;"&gt;&lt;/li&gt;</li>
<li>&lt;/ul&gt;</li>
</ul>
</pre>
</li>
<li>That&#8217;s it as far as PHP &amp; HTML go. Here&#8217;s what we&#8217;ve done so far:
<ol>
<li>Created a class called &#8220;smallentrydate&#8221;. This is a wrapper for our total calendar page.</li>
<li>Created a class called &#8220;date-fill-in-the-blank&#8221;. The big M takes whatever month it is and gives an output of &#8220;sep&#8221; for September, giving you the class, &#8220;dateSep&#8221; or for August&#8221;DateAug&#8221;. Using the shorthand for the month with the big M is going to be vital for when we start on the CSS.</li>
<li>We&#8217;ve also created a class called &#8220;date-fill-in-the-number-date&#8221;&#8230;So if the post was written on the 5th, it outputs a class=&#8221;date05&#8243;.</li>
<li>In the &lt;a&gt; tag, you&#8217;ll see that we also requested the output of a date in the form of &#8216;M&#8217; &#8216;d&#8217;, &#8216;Y&#8217;, which would give us &#8220;Jan 09, 2009&#8243; in text form. If you turn off CSS, you&#8217;ll see this shows up in the place of the calendar image. This is important for accessibility reasons and search engines&#8230;so don&#8217;t leave it out.</li>
</ol>
<li>Simple so far, right? Let&#8217;s move on to the CSS</li>
<li>We&#8217;re going to start out with defining some things about the smallentrydate class in our style.css:
<pre>
<ul>
<li>.smallentrydate {
	float: right; /* floats it to the right */
	height: 55px; /* Total Height of Calendar Image */
	margin: 0 0 10px 0; /* Keeps a good space from text below */
	padding: 0;
	width: 60px; /* Total Width of Calendar Image */
}</li>
<li>.smallentrydate li {
	background: url(images/datecolumns.png) no-repeat;
	list-style: none;
	margin: 0;
	padding: 0;
	top: 0;
}</li>
<li>.smallentrydate li, .smallentrydate a {
	display: block;
	margin: 0;
	overflow: hidden;
	padding: 0;
	text-indent: -1000em; /* Pushes Text off the page, to keep it from showing up with a stylesheet */
	width: 55px;
}</li>
<li>.smallentrydate .dateJan { background-position: -6px -303px; height: 15px; width: 55px; }
</li>
<li>.smallentrydate .date01 { background-position: -6px -318px; height: 45px; width: 55px; }
</li>
</ul>
</pre>
</li>
<li>So to break it all down, this is what we&#8217;re looking at:<br />
</p>
<ol>
<li>We defined the characteristics of our smallentrydate.</li>
<li>Defined the characteristics of our smallentrydate li, most importantly the background-image, and no list-style and the width, which is 55px for every replacing image.</li>
<li>We pushed the text off of the page that would appear on top of the smallentrydate without a text-indent. It gives us the aesthetics of image replacement with the accessibility of text.</li>
</ol>
<li>You&#8217;ll also see that I defined .dateJan &amp; .date01 for you. All I did was find the left and top most boundary on Photoshop of January and put background-position: the left (-6px) &amp; the top (-303px) position where I want it to start. (Make sure to use negatives in front of the values), I also defined the height &amp; width. </li>
</ol>
<p>You&#8217;re going to have to set this background-position system up for all 12 months &#038; 31 days, but 43 is a lot nicer than having to do 365 background-positions. You can also use the CSS included in the support folder, which will save you time typing .smallentrydate .date&#8221;whatever&#8221; everytime.<br />
<br />
Hopefully this helps somebody out there. It&#8217;s been a great project for me to take on and complete.<br />
</p>
<div id="note">
<strong>Note:</strong> <em>This is for a self-hosted Wordpress site. If you have (1) A self-hosted Wordpress but don&#8217;t want to deal with the typing, just download <a href="http://www.chaseadamsphotography.com/wp/wp-content/uploads/2009/09/date_replace_toot/">this folder</a>, include the appropriate parts in the appropriate sections and play with the PSD or (2) I am currently working on making it a plugin for anyone who&#8217;s not interested in the innerworkings as much as just having it. IF you would like for me to make it a plugin, please comment at the bottom and it will help me decide the urgency at which it must be done.</em></div>
]]></content:encoded>
			<wfw:commentRss>http://www.chaseadamsphotography.com/2009/09/07/completely-replace-your-text-dates-in-wordpress-with-images-2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
