<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Include the Category ID via post_class</title>
	<atom:link href="http://digwp.com/2010/01/include-the-category-id-via-post_class/feed/" rel="self" type="application/rss+xml" />
	<link>http://digwp.com/2010/01/include-the-category-id-via-post_class/</link>
	<description>Take your WordPress skills to the next level.</description>
	<lastBuildDate>Fri, 18 May 2012 18:22:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Tyrone Gulliksen</title>
		<link>http://digwp.com/2010/01/include-the-category-id-via-post_class/#comment-3855</link>
		<dc:creator>Tyrone Gulliksen</dc:creator>
		<pubDate>Sat, 20 Mar 2010 22:21:37 +0000</pubDate>
		<guid isPermaLink="false">http://digwp.com/?p=1236#comment-3855</guid>
		<description>Love your blog,  this site has really been an eye opener. I have just got interested in blogging and hopefully i am able to do so</description>
		<content:encoded><![CDATA[<p>Love your blog,  this site has really been an eye opener. I have just got interested in blogging and hopefully i am able to do so</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://digwp.com/2010/01/include-the-category-id-via-post_class/#comment-3239</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Fri, 29 Jan 2010 23:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://digwp.com/?p=1236#comment-3239</guid>
		<description>nm, found an unrelated problem with functions.php

&lt;a href=&quot;http://wordpress.org/support/topic/267604&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>nm, found an unrelated problem with functions.php</p>
<p><a href="http://wordpress.org/support/topic/267604" rel="nofollow">here</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://digwp.com/2010/01/include-the-category-id-via-post_class/#comment-3238</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Fri, 29 Jan 2010 23:33:41 +0000</pubDate>
		<guid isPermaLink="false">http://digwp.com/?p=1236#comment-3238</guid>
		<description>&lt;code&gt;&lt;?php function get_cat_parent_name($post_id) {&lt;/code&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;code&gt;foreach((get_the_category($post_id)) as $category) {&lt;/code&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;code&gt;$catid = $category-&gt;category_parent;&lt;/code&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;code&gt;return get_cat_name($catid);&lt;/code&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;code&gt;}&lt;/code&gt;
&lt;code&gt;}&lt;/code&gt;
&lt;code&gt;?&gt;&lt;/code&gt;

&lt;code&gt;&lt;div &lt;?php post_class(&#039;cat-&#039;.get_cat_parent_name($post-&gt;ID)) ?&gt;&gt;&lt;/code&gt;

used this bit to add category parent class to each post, but adding this to functions.php causes issues with &lt;code&gt;./wp-admin&lt;/code&gt; category editor

any thoughts on this</description>
		<content:encoded><![CDATA[<p><code>&lt;?php function get_cat_parent_name($post_id) {</code><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>foreach((get_the_category($post_id)) as $category) {</code><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>$catid = $category-&gt;category_parent;</code><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>return get_cat_name($catid);</code><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>}</code><br />
<code>}</code><br />
<code>?&gt;</code></p>
<p><code>&lt;div &lt;?php post_class('cat-'.get_cat_parent_name($post-&gt;ID)) ?&gt;&gt;</code></p>
<p>used this bit to add category parent class to each post, but adding this to functions.php causes issues with <code>./wp-admin</code> category editor</p>
<p>any thoughts on this</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Epic Alex</title>
		<link>http://digwp.com/2010/01/include-the-category-id-via-post_class/#comment-3122</link>
		<dc:creator>Epic Alex</dc:creator>
		<pubDate>Tue, 12 Jan 2010 22:20:50 +0000</pubDate>
		<guid isPermaLink="false">http://digwp.com/?p=1236#comment-3122</guid>
		<description>I think you&#039;re right with what you say about knowing the category names, and to be honest, I think people know their category names more than they know their ID&#039;s, but a useful concept non the less.

I also wrote about a few other ways of adding classes to post_class on problogdesign a while ago. It&#039;s a really useful way of fine grain styling.

http://www.problogdesign.com/wordpress/styling-different-posts-in-different-ways-with-post_class/</description>
		<content:encoded><![CDATA[<p>I think you&#8217;re right with what you say about knowing the category names, and to be honest, I think people know their category names more than they know their ID&#8217;s, but a useful concept non the less.</p>
<p>I also wrote about a few other ways of adding classes to post_class on problogdesign a while ago. It&#8217;s a really useful way of fine grain styling.</p>
<p><a href="http://www.problogdesign.com/wordpress/styling-different-posts-in-different-ways-with-post_class/" rel="nofollow">http://www.problogdesign.com/wordpress/styling-different-posts-in-different-ways-with-post_class/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Starr</title>
		<link>http://digwp.com/2010/01/include-the-category-id-via-post_class/#comment-3112</link>
		<dc:creator>Jeff Starr</dc:creator>
		<pubDate>Tue, 12 Jan 2010 16:29:03 +0000</pubDate>
		<guid isPermaLink="false">http://digwp.com/?p=1236#comment-3112</guid>
		<description>Sorry, there was a slight mechanical failure, but I think we&#8217;re back on track now. Thanks for your patience.</description>
		<content:encoded><![CDATA[<p>Sorry, there was a slight mechanical failure, but I think we&rsquo;re back on track now. Thanks for your patience.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pranav</title>
		<link>http://digwp.com/2010/01/include-the-category-id-via-post_class/#comment-3111</link>
		<dc:creator>Pranav</dc:creator>
		<pubDate>Tue, 12 Jan 2010 16:27:45 +0000</pubDate>
		<guid isPermaLink="false">http://digwp.com/?p=1236#comment-3111</guid>
		<description>stop deleting ur text and my comments.</description>
		<content:encoded><![CDATA[<p>stop deleting ur text and my comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Starr</title>
		<link>http://digwp.com/2010/01/include-the-category-id-via-post_class/#comment-3110</link>
		<dc:creator>Jeff Starr</dc:creator>
		<pubDate>Tue, 12 Jan 2010 16:27:00 +0000</pubDate>
		<guid isPermaLink="false">http://digwp.com/?p=1236#comment-3110</guid>
		<description>Thanks for that - filtering the function makes it even better.</description>
		<content:encoded><![CDATA[<p>Thanks for that &#8211; filtering the function makes it even better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Utkarsh</title>
		<link>http://digwp.com/2010/01/include-the-category-id-via-post_class/#comment-3096</link>
		<dc:creator>Utkarsh</dc:creator>
		<pubDate>Tue, 12 Jan 2010 11:16:09 +0000</pubDate>
		<guid isPermaLink="false">http://digwp.com/?p=1236#comment-3096</guid>
		<description>If the theme already includes a post_class call in the post div, I would suggest using filters to add the class.
&lt;code&gt;function category_in_post_class($classes)&lt;/code&gt;
&lt;code&gt;{&lt;/code&gt;
&lt;code&gt;global $post;&lt;/code&gt;
&lt;code&gt;foreach((get_the_category($post-&gt;ID)) as $category)&lt;/code&gt;
&lt;code&gt;$classes [] = &#039;cat-&#039; . $category-&gt;cat_ID;&lt;/code&gt;
&lt;code&gt;return $classes;&lt;/code&gt;
&lt;code&gt;}&lt;/code&gt;
&lt;code&gt;add_filter(&#039;post_class&#039;, &#039;category_in_post_class&#039;);&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>If the theme already includes a post_class call in the post div, I would suggest using filters to add the class.<br />
<code>function category_in_post_class($classes)</code><br />
<code>{</code><br />
<code>global $post;</code><br />
<code>foreach((get_the_category($post-&gt;ID)) as $category)</code><br />
<code>$classes [] = 'cat-' . $category-&gt;cat_ID;</code><br />
<code>return $classes;</code><br />
<code>}</code><br />
<code>add_filter('post_class', 'category_in_post_class');</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

