<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>ThemeShaper Forums Topic: Body and Post Classes for Custom Taxonomies</title>
<link>http://themeshaper.com/forums/</link>
<description>Help In Shaping WordPress Themes</description>
<language>en</language>
<pubDate>Thu, 20 Jun 2013 09:57:34 +0000</pubDate>

<item>
<title>umberto on "Body and Post Classes for Custom Taxonomies"</title>
<link>http://themeshaper.com/forums/topic/body-and-post-classes-for-custom-taxonomies-1#post-23712</link>
<pubDate>Sat, 05 Nov 2011 09:27:20 +0000</pubDate>
<dc:creator>umberto</dc:creator>
<guid isPermaLink="false">23712@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Thanks middlesister&#60;br /&#62;
Nice to have that sorted :)
&#60;/p&#62;</description>
</item>
<item>
<title>middlesister on "Body and Post Classes for Custom Taxonomies"</title>
<link>http://themeshaper.com/forums/topic/body-and-post-classes-for-custom-taxonomies-1#post-23699</link>
<pubDate>Fri, 04 Nov 2011 10:52:32 +0000</pubDate>
<dc:creator>middlesister</dc:creator>
<guid isPermaLink="false">23699@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Congratulations, you have found a bug!&#60;/p&#62;
&#60;p&#62;I found this weird and dug around a bit. Doing a print_r on the $single_post_type-&#38;gt;taxonomy gives the error&#60;br /&#62;
&#60;code&#62;PHP Notice:  Undefined property: stdClass::$taxonomy&#60;/code&#62;&#60;br /&#62;
So of course the rest of the classes never gets added, since the taxonomy property is not set. Turns out it needs to be 'taxonomies', not 'taxonomy'. &#60;/p&#62;
&#60;p&#62;Don't remove those lines, change them to   &#60;code&#62;if ( isset($single_post_type-&#38;gt;taxonomies) )&#60;/code&#62; and it will work. I will file a bug for this.
&#60;/p&#62;</description>
</item>
<item>
<title>umberto on "Body and Post Classes for Custom Taxonomies"</title>
<link>http://themeshaper.com/forums/topic/body-and-post-classes-for-custom-taxonomies-1#post-23679</link>
<pubDate>Thu, 03 Nov 2011 04:27:46 +0000</pubDate>
<dc:creator>umberto</dc:creator>
<guid isPermaLink="false">23679@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Removing &#60;code&#62;if ( isset($single_post_type-&#38;gt;taxonomy) )&#60;/code&#62; from the body class and the post class functions in dynamic-classes.php (line 432 &#38;#38; 106 in rev776) resolves this for me at this point. &#60;/p&#62;
&#60;p&#62;A temporary fix until I can work out what's going on. Could be my custom taxonomies are not set up properly?&#60;/p&#62;
&#60;p&#62;Any insights welcome
&#60;/p&#62;</description>
</item>
<item>
<title>umberto on "Body and Post Classes for Custom Taxonomies"</title>
<link>http://themeshaper.com/forums/topic/body-and-post-classes-for-custom-taxonomies-1#post-23673</link>
<pubDate>Wed, 02 Nov 2011 08:08:21 +0000</pubDate>
<dc:creator>umberto</dc:creator>
<guid isPermaLink="false">23673@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;I'm trying to get post and body classes working for custom taxonomies using the latest thematic (rev 776) and WP 3.2.1. &#60;/p&#62;
&#60;p&#62;From what I have read in the changelog, 'Post and Body classes for custom taxonomies' were added back in 0.9.7.4 and there is a bunch of code in dynamic-classes.php that looks the part: &#60;/p&#62;
&#60;p&#62;in function thematic_body_class around line 100 :&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// Adds taxonomy classes for each term on single posts
			$single_post_type = get_post_type_object(get_post_type($post-&#38;gt;ID));

			// Check for post types without taxonomy inclusion
			if ( isset($single_post_type-&#38;gt;taxonomy) ) {
			    if ( $tax = get_the_terms($post-&#38;gt;ID, get_post_taxonomies() )) {
			    	foreach ( $tax as $term )   {
			    		// Remove tags and categories from results
			    		if  ( $term-&#38;gt;taxonomy != &#38;#39;post_tag&#38;#39; )	{
			    			if  ( $term-&#38;gt;taxonomy != &#38;#39;category&#38;#39; )   {
			    				$c[] = &#38;#39;s-tax-&#38;#39; . $term-&#38;gt;taxonomy;
			    				$c[] = &#38;#39;s-&#38;#39; . $term-&#38;gt;taxonomy . &#38;#39;-&#38;#39; . $term-&#38;gt;slug;
			    			}
			    		}
			    	}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;around line 180, &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// Taxonomy name classes for BODY on tag archives

		elseif ( is_tax() &#38;#38;&#38;#38; apply_filters(&#38;#39;thematic_show_bc_taxonomyarchives&#38;#39;, TRUE)) {
			$c[] = &#38;#39;taxonomy&#38;#39;;
			$c[] = &#38;#39;tax-&#38;#39; . $taxonomy;
			$c[] = $taxonomy . &#38;#39;-&#38;#39; . strtolower(thematic_get_term_name());
		}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;and in function thematic_post_class around line 430,&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if (function_exists(&#38;#39;get_post_type_object&#38;#39;)) {
			// Taxonomies and terms for the post queried
			$single_post_type = get_post_type_object(get_post_type($post-&#38;gt;ID));
			// Check for post types without taxonomy inclusion
			if ( isset($single_post_type-&#38;gt;taxonomy) ) {
				foreach ( (array) get_the_terms( $post-&#38;gt;ID, get_post_taxonomies() )  as $term  )   {
					// Remove tags and categories from results
					if  ( $term-&#38;gt;taxonomy != &#38;#39;category&#38;#39; )	{
						if  ( $term-&#38;gt;taxonomy != &#38;#39;post_tag&#38;#39; )   {
							$c[] = &#38;#39;p-tax-&#38;#39; . $term-&#38;gt;taxonomy;
							$c[] = &#38;#39;p-&#38;#39; . $term-&#38;gt;taxonomy . &#38;#39;-&#38;#39; . $term-&#38;gt;slug;
						}
					}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;However, I've test this on a stripped back install, on several earlier thematic versions and am only seeing classes for custom taxonomy archive pages. &#60;/p&#62;
&#60;p&#62;I may be mistaken but in light of the above was expecting taxonomy classes in much the same manner as category and tag classes. &#60;/p&#62;
&#60;p&#62;So I'd love some feedback:&#60;/p&#62;
&#60;p&#62;1. Is this is a known bug (which would seem odd given it was introduced a while ago)&#60;br /&#62;
2. Is this is known to work as expected and the problem is somewhere on my end - highly likely I'm missing the obvious :)&#60;br /&#62;
3. Although I don't think it's made it to WP core yet, this seems like a handy/essential bit of functionality. There are some solutions out there e.g. this from  &#60;a href=&#34;http://creersitepro.com/2011/post_type_css_taxonomy/&#34; rel=&#34;nofollow&#34;&#62;http://creersitepro.com/2011/post_type_css_taxonomy/&#60;/a&#62;&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function custom_fix_post_type_classes($classes, $class, $ID) {
	$post = get_post($ID);
	$taxonomies = ($post-&#38;gt;post_type != &#38;#39;post&#38;#39; &#38;#38;&#38;#38; $post-&#38;gt;post_type != &#38;#39;page&#38;#39; &#38;#38;&#38;#38; $post-&#38;gt;post_type != &#38;#39;attachement&#38;#39;) ? get_object_taxonomies($post-&#38;gt;post_type) :  false ;
	if(is_array($taxonomies)) {
		foreach($taxonomies as $taxonomy) {
			$terms = get_the_terms( $post-&#38;gt;ID, $taxonomy );
			if(is_array($terms)) {
				foreach($terms as $term) {
					$classes[] .= &#38;#39; &#38;#39;.$taxonomy .&#38;#39;-&#38;#39;. $term-&#38;gt;slug ;
				}
			}
		}
	}
	return $classes;
}
add_filter(&#38;#39;post_class&#38;#39;,&#38;#39;custom_fix_post_type_classes&#38;#39;,10,3);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;which I haven't quite managed to adapt to thematic yet. I will press with this (using my beginner/improving php skills) as I need to find a solution. Has anyone encountered and/or resolved this same issue?&#60;/p&#62;
&#60;p&#62;Appreciate any pointers.
&#60;/p&#62;</description>
</item>

</channel>
</rss>
