<?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>Whimsical.Nu &#187; categories</title>
	<atom:link href="http://whimsical.nu/tag/categories/feed/" rel="self" type="application/rss+xml" />
	<link>http://whimsical.nu</link>
	<description>A whimsical blog by a whimsical girl with five different psyches: girl, geek, reader, writer, and gamer</description>
	<lastBuildDate>Fri, 03 Feb 2012 08:02:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>New layout, and tinkering with WordPress categories</title>
		<link>http://whimsical.nu/2009/10/18/new-layout-and-tinkering-with-wordpress-categories/</link>
		<comments>http://whimsical.nu/2009/10/18/new-layout-and-tinkering-with-wordpress-categories/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 19:19:38 +0000</pubDate>
		<dc:creator>Angela</dc:creator>
				<category><![CDATA[Geek chick]]></category>
		<category><![CDATA[Website]]></category>
		<category><![CDATA[categories]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://whimsical.nu/?p=722</guid>
		<description><![CDATA[I&#8217;ve been working on and off on this new layout for a while, but today I&#8217;ve doubled down to get it all coded and running. Nothing was wrong with the older layout, of course, but I just felt it was a little cluttered, and I felt somewhat pressured to write longer posts just to fill up all that space in line with the contents on the sidebar. Ergh. I also wanted a more obvious division between different categories, but not so much that moving from one category to the next would be a jarring experience. So I came up with...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on and off on this new layout for a while, but today I&#8217;ve doubled down to get it all coded and running. Nothing was wrong with the older layout, of course, but I just felt it was a little cluttered, and I felt somewhat pressured to write longer posts just to fill up all that space in line with the contents on the sidebar. Ergh. I also wanted a more obvious division between different categories, but not so much that moving from one category to the next would be a jarring experience.</p>
<p>So I came up with this :D I am rather pleased with it, especially for the coding that&#8217;s gone behind it. The layout has a lot of specific handling depending on which category the currently-visible post is in:</p>
<ol>
<li>Cartoon head background and post &#8220;icon&#8221; obviously depend on the post&#8217;s category; click on each of the categories to see them all.</li>
<li>Where possible, I use the category&#8217;s &#8220;color&#8221; to indicate categories, such as the footer background, and the most recent category posts on the top right of the header.</li>
<li>The top right header obviously shows the most recent post from each category&#8211;except, of course, when you&#8217;re already viewing that post!</li>
<li>Post title color will also mirror the category the post belongs to.</li>
<li>The next and back links found at the post&#8217;s meta area will also mirror the type of posts you&#8217;re scrolling through. A brown arrow means you&#8217;re not in a category!</li>
<li>The contents of the footer will also vary slightly depending on the &#8220;active&#8221; category.</li>
</ol>
<p>To pull most of the styling changes off, I needed the category of the post on the page itself, as well as on various areas of the blog to get the proper information. This wasn&#8217;t a problem for category pages, but for all the rest? I ended up doing a small bit of hackery (note this will only work on pages that contain just one post), and crossing my fingers that my blog won&#8217;t break in future <acronym title="WordPress">WP</acronym> versions:</p>
<pre>function get_current_top_category() {
	$CATEGORIES = array(
		3 =&gt; 'girl',
		4 =&gt; 'geek',
		5 =&gt; 'reader',
		6 =&gt; 'writer',
		7 =&gt; 'gamer'
	);
	$current_top_category = 0;

	global $post;
	$post_id = $post-&gt;ID;
	$categories = get_the_category( $post_id );
	foreach( $categories as $c ) {
		if( in_array( $c-&gt;slug, $CATEGORIES ) ) {
			$current_top_category = $c-&gt;cat_ID;
			break;
		}
	}
	return $current_top_category;
}</pre>
<p>The function works well both with just getting the current category for content manipulation, as well as adding an extra class to the <code>body</code> tag, as mentioned in <a href="http://www.nathanrice.net/blog/wordpress-2-8-and-the-body_class-function/">this post via the <code>body_class</code> function</a>.</p>
<p>All that said, I still need to get a couple of things working. I haven&#8217;t checked on <acronym title="Internet Explorer">IE</acronym> browsers yet (and I don&#8217;t have any more plans of checking <acronym title="Internet Explorer 6">IE6</acronym>&#8230; *shakes fist at it*), and I need to optimize the PNGs I used; I also want comments to show on each page, even if it&#8217;s not the single post page; and a couple more meta stuff couldn&#8217;t hurt, probably! They will all need to be done at a later date, though; I&#8217;m bushed!</p>
<p>Let me know if you see anything glaringly wrong :D</p>]]></content:encoded>
			<wfw:commentRss>http://whimsical.nu/2009/10/18/new-layout-and-tinkering-with-wordpress-categories/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

