<?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>Neoclassical Theme for WordPress &#187; How To</title>
	<atom:link href="http://pearsonified.com/theme/neoclassical/category/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://pearsonified.com/theme/neoclassical</link>
	<description>A 3-column template system with rotating header images</description>
	<lastBuildDate>Thu, 13 Dec 2007 04:42:23 +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>How to Customize Your Random Header Images</title>
		<link>http://pearsonified.com/theme/neoclassical/customize-random-header-images/</link>
		<comments>http://pearsonified.com/theme/neoclassical/customize-random-header-images/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 22:07:05 +0000</pubDate>
		<dc:creator>Chris Pearson</dc:creator>
				<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://pearsonified.com/theme/neoclassical/customize-random-header-images/</guid>
		<description><![CDATA[
After downloading Neoclassical, one of the first things you&#8217;ll want to do is customize the random header images that now grace the top of your site&#8217;s pages. Doing this effectively requires knowledge of exactly how these things work, and with my help, you&#8217;ll be a professional image randomizer in no time.
Oh, but before we go [...]]]></description>
			<content:encoded><![CDATA[<p><img class="block frame" src="http://pearsonified.com/theme/neoclassical/images/custom.jpg" width="405" height="68" alt="custom" title="Kick it up a notch with custom rotating header images" /></p>
<p>After downloading Neoclassical, one of the first things you&#8217;ll want to do is customize the random header images that now grace the top of your site&#8217;s pages. Doing this effectively requires knowledge of exactly how these things work, and with my help, you&#8217;ll be a professional image randomizer in no time.</p>
<p>Oh, but before we go any further, you&#8217;ll need to download and install the <a href="http://pearsonified.com/theme/neoclassical/downloads/rotating_images.zip">updated version</a> of <code>rotating_images.php</code>. In order to provide you with a more robust rotator, I had to modify the original code slightly. <span id="more-4"></span></p>
<h3>Background Information</h3>
<p>The Neoclassical Theme comes with a folder named <code>/headers</code> that contains the 5 default images used in the rotator. These header image files all follow a simple naming convention:</p>
<ul>
<li><code>header_1.jpg</code></li>
<li><code>header_2.jpg</code></li>
<li><code>header_3.jpg</code></li>
<li><code>header_4.jpg</code></li>
<li><code>header_5.jpg</code></li>
</ul>
<p>On default installations, these header images are controlled by a theme file named <code>rotating_images.php</code>. This is a simple <acronym title="Recursive acronym for Hypertext Preprocessor">PHP</acronym> script that randomly selects one image from the <code>/headers</code> folder and displays it using the appropriate <acronym title="HyperText Markup Language">HTML</acronym>.</p>
<p>The script, which consists of two main parts, is easy to understand. First, we generate a random number based on the total number of images in our <code>/headers</code> folder (this number is <strong>manually controlled</strong>, and the default is 5):</p>
<pre class="php">
&lt;?php
   <span class="var">$random_image</span> <span class="operator">=</span> <span class="library_function">rand</span>(<span class="num">1</span>,<span class="num">5</span>);
?&gt;
</pre>
<p>Next, we output the image associated with the random number we just generated:</p>
<pre class="html">
&lt;<strong>img</strong> <span class="attribute">src</span>=<span class="str">&quot;<span class="embed">&lt;?php bloginfo(<span class="str">&#39;template_url&#39;</span>); ?&gt;</span>/headers/header_<span class="embed">&lt;?php <span class="library_function">echo</span> <span class="var">$random_image</span>; ?&gt;</span>.jpg&quot;</span> ... /&gt;
</pre>
<p>In the above code, note the occurrence of the variable <code class="embed var">$random_image</code>. Because this value changes randomly, the filename referenced in the image declaration also changes.</p>
<h3>Quick Customization Example</h3>
<p>Now that you know a little bit about how the random header generator works, let&#8217;s tweak it a little bit. For this example, let&#8217;s say that we we&#8217;ve created 8 killer header images, and we&#8217;d like to replace the default images with these new ones for display on our site.</p>
<p><strong>Step one</strong> is to ensure that your images follow the required naming convention—<code>header_1.jpg</code>, <code>header_2.jpg</code>, <code>header_3.jpg</code>, and so on. It&#8217;s also important that your image subscripts start with 1 and increase in increments of 1, because any other configuration would require additional modification of the script.</p>
<p><strong>Step two</strong> is to upload those images to your <code>/headers</code> folder, which is located inside your base <code>/neoclassical</code> theme folder.</p>
<p><strong>Step three</strong> is to keep in mind that the default configuration can only accommodate 5 header images. In our example, however, we&#8217;re looking to include 8 images, and in order to pull this off, we&#8217;ll need to make a very slight modification to <code>rotating_images.php</code>:</p>
<pre class="php">
&lt;?php
   <span class="var">$random_image</span> <span class="operator">=</span> <span class="library_function">rand</span>(<span class="num">1</span>,<span class="num highlight">8</span>);
?&gt;
</pre>
<p>In the above code, all I did was replace the default value of 5 with the number 8 (highlighted, kinda). Once you save and upload this modified version of <code>rotating_image.php</code>, you&#8217;ll have an image rotator that displays one of eight random images on each page of your site.</p>
<h3>A Few Details&#8230;</h3>
<p>The default header images are all 865px wide by 180px tall. Personally, I think this makes for a relatively unobtrusive yet visually striking crop, but your mileage may vary. Either way, I think you&#8217;ll appreciate the balance of your design the most if you keep your images that width.</p>
<p>If you use an image that is less than 865px wide, it will align to the left underneath the site title, leaving a visual gap of whitespace to the right of the image. In the event you simply must use such an image, I recommend leaving it aligned to the left. Despite that, I know many of you will want to tinker with a center-aligned image, and in order to do that, all you need to do is add the following declaration to your custom stylesheet, <code>custom.css</code>:</p>
<pre class="css">
.custom #rotating_image <strong>img</strong> {
   <span class="property">margin</span>: <span class="num">0</span> <span class="str">auto</span>;
}
</pre>
<p>Actually, while you&#8217;re at it, why not check out a right-aligned image, too:</p>
<pre class="css">
.custom #rotating_image <strong>img</strong> {
   <span class="property">margin</span>: <span class="num">0</span> <span class="num">0</span> <span class="num">0</span> <span class="str">auto</span>;
}
</pre>
<p>Now who can resist the urge to customize after that? <img src='http://pearsonified.com/theme/neoclassical/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://pearsonified.com/theme/neoclassical/customize-random-header-images/feed/</wfw:commentRss>
		<slash:comments>445</slash:comments>
		</item>
	</channel>
</rss>
