<?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 Tag: dynamic classes</title>
<link>http://themeshaper.com/forums/</link>
<description>Help In Shaping WordPress Themes</description>
<language>en</language>
<pubDate>Fri, 24 May 2013 19:30:42 +0000</pubDate>

<item>
<title>helgatheviking on "How to add a class to the body tag with a filter?"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-a-class-to-the-body-tag-with-a-filter#post-24203</link>
<pubDate>Thu, 08 Dec 2011 12:11:53 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">24203@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;cue the happy trombones!
&#60;/p&#62;</description>
</item>
<item>
<title>benfrain.com on "How to add a class to the body tag with a filter?"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-a-class-to-the-body-tag-with-a-filter#post-24202</link>
<pubDate>Thu, 08 Dec 2011 12:06:23 +0000</pubDate>
<dc:creator>benfrain.com</dc:creator>
<guid isPermaLink="false">24202@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hallelujah and pass the biscuits! Thanks Kathy, you're a gem!
&#60;/p&#62;</description>
</item>
<item>
<title>helgatheviking on "How to add a class to the body tag with a filter?"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-a-class-to-the-body-tag-with-a-filter#post-24189</link>
<pubDate>Thu, 08 Dec 2011 00:55:10 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">24189@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;so close ben, but you need to return $c no matter what. i think this should do it: &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function extend_body_class($c) {
	if (function_exists(&#38;#39;is_bbpress&#38;#39;) &#38;#38;&#38;#38; is_bbpress()) {
	   $c[] = &#38;#39;bbForum&#38;#39;;
        }
	return $c;
}
add_filter(&#38;#39;thematic_body_class&#38;#39;, &#38;#39;extend_body_class&#38;#39;);&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>benfrain.com on "How to add a class to the body tag with a filter?"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-a-class-to-the-body-tag-with-a-filter#post-24188</link>
<pubDate>Wed, 07 Dec 2011 22:37:56 +0000</pubDate>
<dc:creator>benfrain.com</dc:creator>
<guid isPermaLink="false">24188@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;I'm amending a filter I'd seen Chris had posted elsewhere in the forum: &#60;a href=&#34;http://themeshaper.com/forums/topic/how-to-add-a-class-to-the-ltbodygt-declaration&#34; rel=&#34;nofollow&#34;&#62;http://themeshaper.com/forums/topic/how-to-add-a-class-to-the-ltbodygt-declaration&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I'm trying to adapt it to do the following:&#60;/p&#62;
&#60;p&#62;1. If the page is a forum (bbpress) page - add the class 'bbforum' to the body&#60;br /&#62;
2. If it isn't a forum page - leave the dynamic classes as they were before&#60;/p&#62;
&#60;p&#62;Here's what I have in functions.php:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function extend_body_class($c) {
	if (function_exists(&#38;#39;is_bbpress&#38;#39;) &#38;#38;&#38;#38; is_bbpress()) {
	$c[] = &#38;#39;bbForum&#38;#39;;
	return $c;
	}
}
add_filter(&#38;#39;thematic_body_class&#38;#39;, &#38;#39;extend_body_class&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Which works fine on the forum pages, however, on other pages it is truncating the dynamic classes. What do I need to change to stop it doing that????
&#60;/p&#62;</description>
</item>
<item>
<title>wlanni on "List of body class selectors for os/browsers?"</title>
<link>http://themeshaper.com/forums/topic/list-of-body-class-selectors-for-osbrowsers#post-22797</link>
<pubDate>Mon, 22 Aug 2011 10:34:05 +0000</pubDate>
<dc:creator>wlanni</dc:creator>
<guid isPermaLink="false">22797@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Great. I'm curious, anyone know how Android, iPad and windows phone appear? Would the preg_math look for /Android/, /iPad/, /Windows/?
&#60;/p&#62;</description>
</item>
<item>
<title>Devin on "List of body class selectors for os/browsers?"</title>
<link>http://themeshaper.com/forums/topic/list-of-body-class-selectors-for-osbrowsers#post-14051</link>
<pubDate>Wed, 21 Jul 2010 20:50:18 +0000</pubDate>
<dc:creator>Devin</dc:creator>
<guid isPermaLink="false">14051@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Thanks Gene.  I'll try it out.  Didn't realize I could try that trick with &#34;UserAgent&#34;- should be helpful as well.
&#60;/p&#62;</description>
</item>
<item>
<title>em hr on "List of body class selectors for os/browsers?"</title>
<link>http://themeshaper.com/forums/topic/list-of-body-class-selectors-for-osbrowsers#post-14020</link>
<pubDate>Tue, 20 Jul 2010 19:46:12 +0000</pubDate>
<dc:creator>em hr</dc:creator>
<guid isPermaLink="false">14020@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hi Devin,&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function mobile_body_class($classes) {

	$browser = $_SERVER[ &#38;#39;HTTP_USER_AGENT&#38;#39; ];

	if ( preg_match( &#38;quot;/iPhone/&#38;quot;, $browser ) ){
		$classes[] = &#38;#39;mobile-safari&#38;#39;;
		}
	return $classes;
}

add_filter(&#38;#39;body_class&#38;#39;,&#38;#39;mobile_body_class&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;This should work as a function for a child-theme. I ran a quick test using the Develop&#38;gt;UserAgent switcher in Safari to spoof the browser.&#60;/p&#62;
&#60;p&#62;I like the mobile-safari class better since this preg_match seems to return true for iPod Touches as well.&#60;/p&#62;
&#60;p&#62;-Gene
&#60;/p&#62;</description>
</item>
<item>
<title>Devin on "List of body class selectors for os/browsers?"</title>
<link>http://themeshaper.com/forums/topic/list-of-body-class-selectors-for-osbrowsers#post-14018</link>
<pubDate>Tue, 20 Jul 2010 17:51:14 +0000</pubDate>
<dc:creator>Devin</dc:creator>
<guid isPermaLink="false">14018@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;I was trying to add an iPhone body class but couldn't seem to get it to work.  Has anyone done this?  I was just working directly on Thematic to start:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;} elseif ( preg_match( &#38;quot;/iPhone/&#38;quot;, $browser ) ){
		$c[] = &#38;#39;iphone&#38;#39;;&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>em hr on "List of body class selectors for os/browsers?"</title>
<link>http://themeshaper.com/forums/topic/list-of-body-class-selectors-for-osbrowsers#post-10209</link>
<pubDate>Fri, 26 Feb 2010 03:02:20 +0000</pubDate>
<dc:creator>em hr</dc:creator>
<guid isPermaLink="false">10209@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hi marcopolo,&#60;/p&#62;
&#60;p&#62;Look here for the &#60;code&#62;thematic_body_class&#60;/code&#62; function that creates the classes:&#60;/p&#62;
&#60;p&#62;thematic&#38;gt;library&#38;gt;extensions&#38;gt;dynamic-classes.php&#60;/p&#62;
&#60;p&#62;about two hundred lines down the page you'll see the browser detection &#38;#38; class insertion block of code. Look for the comment&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;// A little Browser detection shall we?&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62; All of the &#60;code&#62;$c[] = &#38;#39;&#38;#39;;&#60;/code&#62; represent classes that will potentially be added to the array. Therein lies your answer.&#60;/p&#62;
&#60;p&#62;-Gene
&#60;/p&#62;</description>
</item>
<item>
<title>marcopolo on "List of body class selectors for os/browsers?"</title>
<link>http://themeshaper.com/forums/topic/list-of-body-class-selectors-for-osbrowsers#post-10207</link>
<pubDate>Fri, 26 Feb 2010 02:09:45 +0000</pubDate>
<dc:creator>marcopolo</dc:creator>
<guid isPermaLink="false">10207@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hey, I've been dipping into this forum for the past couple months for answers on all things Thematic. So far it's been very helpful, thanks.&#60;/p&#62;
&#60;p&#62;Now I'm at the stage of ironing out cross-browser quirks (e.g., submit button rendering in IE6 ... Aaargh!) and I want to make sure I'm using the proper selectors. The is the list of dynamic body class selectors I've culled from dynamic-classes.php. Let me know if it's complete and correct, thanks.&#60;/p&#62;
&#60;p&#62;.mac&#60;br /&#62;
.windows&#60;br /&#62;
.linux&#60;/p&#62;
&#60;p&#62;.chrome&#60;br /&#62;
.safari&#60;br /&#62;
.opera&#60;br /&#62;
.msie&#60;br /&#62;
.ie6&#60;br /&#62;
.ie7&#60;br /&#62;
.ie8&#60;br /&#62;
.firefox
&#60;/p&#62;</description>
</item>
<item>
<title>logicoder on "Dynamic Classes - Include Slug"</title>
<link>http://themeshaper.com/forums/topic/dynamic-classes-include-slug#post-1254</link>
<pubDate>Sun, 11 Jan 2009 16:25:12 +0000</pubDate>
<dc:creator>logicoder</dc:creator>
<guid isPermaLink="false">1254@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;In SVN.
&#60;/p&#62;</description>
</item>
<item>
<title>logicoder on "Dynamic Classes - Include Slug"</title>
<link>http://themeshaper.com/forums/topic/dynamic-classes-include-slug#post-1236</link>
<pubDate>Fri, 09 Jan 2009 15:53:28 +0000</pubDate>
<dc:creator>logicoder</dc:creator>
<guid isPermaLink="false">1236@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Here's the diff:&#60;/p&#62;
&#60;p&#62;Index: dynamic-classes.php&#60;br /&#62;
===================================================================&#60;br /&#62;
--- dynamic-classes.php	(revisione 259)&#60;br /&#62;
+++ dynamic-classes.php	(copia locale)&#60;br /&#62;
@@ -25,6 +25,9 @@&#60;br /&#62;
 		$postID = $wp_query-&#38;gt;post-&#38;gt;ID;&#60;br /&#62;
 		the_post();&#60;/p&#62;
&#60;p&#62;+    // Adds post slug class, prefixed by 'slug-'&#60;br /&#62;
+    $c[] = 'slug-' . $wp_query-&#38;gt;post-&#38;gt;post_name;&#60;br /&#62;
+&#60;br /&#62;
 		// Adds 'single' class and class with the post ID&#60;br /&#62;
 		$c[] = 'single postid-' . $postID;&#60;/p&#62;
&#60;p&#62;@@ -80,6 +83,10 @@&#60;br /&#62;
 		$pageID = $wp_query-&#38;gt;post-&#38;gt;ID;&#60;br /&#62;
 		$page_children = wp_list_pages(&#34;child_of=$pageID&#38;#38;echo=0&#34;);&#60;br /&#62;
 		the_post();&#60;br /&#62;
+&#60;br /&#62;
+    // Adds post slug class, prefixed by 'slug-'&#60;br /&#62;
+    $c[] = 'slug-' . $wp_query-&#38;gt;post-&#38;gt;post_name;&#60;br /&#62;
+&#60;br /&#62;
 		$c[] = 'page pageid-' . $pageID;&#60;br /&#62;
 		$c[] = 'page-author-' . sanitize_title_with_dashes(strtolower(get_the_author('login')));&#60;br /&#62;
 		// Checks to see if the page has children and/or is a child page; props to Adam&#60;br /&#62;
@@ -171,6 +178,9 @@&#60;br /&#62;
 	if ( ++$thematic_post_alt % 2 )&#60;br /&#62;
 		$c[] = 'alt';&#60;/p&#62;
&#60;p&#62;+  // Adds post slug class, prefixed by 'slug-'&#60;br /&#62;
+  $c[] = 'slug-' . $post-&#38;gt;post_name;&#60;br /&#62;
+&#60;br /&#62;
 	// Separates classes with a single space, collates classes for post DIV&#60;br /&#62;
 	$c = join( ' ', apply_filters( 'post_class', $c ) ); // Available filter: post_class
&#60;/p&#62;</description>
</item>
<item>
<title>logicoder on "Dynamic Classes - Include Slug"</title>
<link>http://themeshaper.com/forums/topic/dynamic-classes-include-slug#post-1235</link>
<pubDate>Fri, 09 Jan 2009 15:15:32 +0000</pubDate>
<dc:creator>logicoder</dc:creator>
<guid isPermaLink="false">1235@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;just add this line to the thematic_post_class function in dynamic-classes.php before line 175:&#60;/p&#62;
&#60;p&#62;    $c[] = 'slug-' . $post-&#38;gt;post_name;&#60;/p&#62;
&#60;p&#62;Et voilà, you will have a class named slug-something (e.g. slug-home, slug-about).&#60;/p&#62;
&#60;p&#62;Hope it helps,&#60;br /&#62;
Marco Del Tongo
&#60;/p&#62;</description>
</item>
<item>
<title>patdryburgh on "Dynamic Classes - Include Slug"</title>
<link>http://themeshaper.com/forums/topic/dynamic-classes-include-slug#post-1199</link>
<pubDate>Mon, 29 Dec 2008 17:52:02 +0000</pubDate>
<dc:creator>patdryburgh</dc:creator>
<guid isPermaLink="false">1199@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hey Ian, &#60;/p&#62;
&#60;p&#62;Been a while since I've had time to toy around with Thematic. I'm back at it right now and have a question about dynamic classes. I am trying to add a dynamic class to the body class that gives me the page or post's slug. So, if the title of the page is &#34;Advancement Centre,&#34; the dynamic class would add &#34;advancement-centre&#34; to my body class. Any ideas?&#60;/p&#62;
&#60;p&#62;Thanks bud! Hope you had a great Christmas.
&#60;/p&#62;</description>
</item>

</channel>
</rss>
