<?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>Oncemade &#187; PHP</title>
	<atom:link href="http://oncemade.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://oncemade.com</link>
	<description>Design, Web Dev, Inspiration</description>
	<lastBuildDate>Fri, 09 Jul 2010 02:06:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Create Date Badge with WordPress and CSS</title>
		<link>http://oncemade.com/create-date-badge-with-wordpress-and-css/</link>
		<comments>http://oncemade.com/create-date-badge-with-wordpress-and-css/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 03:29:03 +0000</pubDate>
		<dc:creator>Rodrigo</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Badge]]></category>
		<category><![CDATA[Date]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Markup]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://oncemade.com/?p=510</guid>
		<description><![CDATA[This tutorial will walk you through creating date badges with WordPress and CSS. Let&apos;s start of by adding the necessary [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial will walk you through creating date badges with <a href="http://www.wordpress.com" title="WordPress.com">WordPress</a> and <abbr title="Cascading Style Sheets">CSS</abbr>.</p>
<p class="aligncenter"><img src="http://oncemade.com/wp-content/uploads/2009/04/datebadgesample.png" alt="Date Badge Sample" title="Date Badge Sample" width="518" height="180" class="alignnone size-full wp-image-537" /></p>

<p>
  Let&apos;s start of by adding the necessary markup to render the appropriate date format. Create a <em>DIV</em> element with a class of &quot;entryDate&quot; and three children <em>SPANs</em> with respective classes &quot;postMoth&quot;, &quot;postDay&quot;, and &quot;postYear&quot;.<br />
  Add the PHP code to get the post date from the database as shown bellow. For more PHP date format go to <a href="http://us.php.net/date" title="PHP Date Format">http://us.php.net/date</a>
</p>

<pre><h4>Markup</h4><code>&lt;div class=&quot;entryDate&quot;&gt;
   &lt;span class=&quot;postMonth&quot;&gt;&lt;?php the_time(&apos;M&apos;) ?&gt;&lt;/span&gt;
   &lt;span class=&quot;postDay&quot;&gt;&lt;?php the_time(&apos;d&apos;) ?&gt;&lt;/span&gt;
   &lt;span class=&quot;postYear&quot;&gt;&lt;?php the_time(&apos;Y&apos;) ?&gt;&lt;/span&gt;
&lt;/div&gt;</code></pre>

<p>Now let's add styles to make it look pretty.</p>
<span id="more-510"></span>
<p>First of all, set the body <em>font-size</em> to 10px or 62.5%. Then go ahead and set the <em>DIV</em> that wraps the post entry to <em>position: relative</em> so the date badge can be positioned relatively to it. Set <em>margin-left</em> to the width of the date badge plus the gap between the post entry. In this sample the <em>margin-left</em> is set to 4.8em.</p>
<p>Absolute position the <em>entryDate</em> and set the <em>left</em> to the same size as the its parent <em>margin-left</em>. After that, set the width to 3.5em. Next, set all the <em>SPANs</em> inside <em>entryDate</em> as <em>block element</em> (The reason why <em>SPANs</em> are being used instead of <em>DIVs</em> is because if the <em>stylesheet</em> is disabled, the date renders nicely in one line). Don't forget to centered align the text. </p>
<p>Change the appearance as needed, I have changed the size of the text to look more like a calendar and I've set its color to blue and white.</p>


<pre><h4>CSS</h4><code>body { font-size: 62.5%; }
.post { 
    position: relative;
    margin-left: 4.8em;
}
.entryDate { 
    border: 1px solid #999; 
    font-family: Georgia,&quot;Times New Roman&quot;, serif; 
    left: -4.8em; 
    line-height: 1; 
    position: absolute; 
    top: 0; 
    width: 3.5em;
}
.entryDate span { 
    display: block; 
    text-align: center; 
}
.postMonth { 
    text-transform: uppercase; 
    font-size: 1.2em;
    padding-top: 0.3em; 
}
.postDay { font-size: 2em; }
.postYear { 
    background-color: #2358B8; 
    color: #FFF; 
    font-size: 1.2em; 
    padding: 0.3em 0; 
    margin-top: 0.3em;
}

</code></pre>

<p>Don't forget to checkout the live demo</p>

<a href="http://examples.oncemade.com" title="Date Badge Demo" class="demoBtn" target="_blank">Demo</a>

<h4>Browser Support</h4>
<ul class="browserComp clearfix">
   <li class="firefoxComp"><span>Firefox</span></li>
   <li class="safariComp"><span>Safari</span></li>
   <li class="chromeComp"><span>Chrome</span></li>
   <li class="operaComp"><span>Opera</span></li>
   <li class="ie7Comp"><span>Internet Explore 7 &amp; 8</span></li>
<li class="ie6Comp"><span>Internet Explore 6</span></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://oncemade.com/create-date-badge-with-wordpress-and-css/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
