<?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: Conditional childtheme_override</title>
<link>http://themeshaper.com/forums/</link>
<description>Help In Shaping WordPress Themes</description>
<language>en</language>
<pubDate>Thu, 20 Jun 2013 02:58:59 +0000</pubDate>

<item>
<title>ridgely on "Conditional childtheme_override"</title>
<link>http://themeshaper.com/forums/topic/conditional-childtheme_override#post-15432</link>
<pubDate>Tue, 07 Sep 2010 17:24:45 +0000</pubDate>
<dc:creator>ridgely</dc:creator>
<guid isPermaLink="false">15432@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;This mysteriously caused my &#34;blog&#34; page to go blank. Wonder why?
&#60;/p&#62;</description>
</item>
<item>
<title>ridgely on "Conditional childtheme_override"</title>
<link>http://themeshaper.com/forums/topic/conditional-childtheme_override#post-15418</link>
<pubDate>Tue, 07 Sep 2010 03:02:06 +0000</pubDate>
<dc:creator>ridgely</dc:creator>
<guid isPermaLink="false">15418@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;&#60;strong&#62;TAKE 2&#60;/strong&#62;&#60;br /&#62;
This, however, worked:&#60;/p&#62;
&#60;blockquote&#62;&#60;pre&#62;&#60;code&#62;function my_conditional_category_loop() {
	if (is_category(&#38;#39;drawing&#38;#39;) &#124;&#124; is_category(&#38;#39;painting&#38;#39;)) {
	 	while ( have_posts()	)	:	the_post();

		thematic_abovepost(); ?&#38;gt;

		&#38;lt;div id=&#38;quot;post-&#38;lt;?php	the_ID() ?&#38;gt;&#38;quot; class=&#38;quot;&#38;lt;?php	thematic_post_class()	?&#38;gt;&#38;quot;&#38;gt;
				&#38;lt;?php	thematic_postheader(); ?&#38;gt;
				&#38;lt;?php	get_the_image( array(	&#38;#39;custom_key&#38;#39; =&#38;gt;	array( &#38;#39;Thumbnail&#38;#39;,	&#38;#39;thumbnail&#38;#39;	), &#38;#39;default_size&#38;#39;	=&#38;gt; &#38;#39;thumbnail&#38;#39; ) );	?&#38;gt;
				&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;
		&#38;lt;?php	thematic_content();	?&#38;gt;
				&#38;lt;/div&#38;gt;
				&#38;lt;?php	thematic_postfooter(); ?&#38;gt;
		&#38;lt;/div&#38;gt;&#38;lt;!-- .post --&#38;gt;
		&#38;lt;?php 

				thematic_belowpost();

		endwhile;
	} else {
		while (have_posts()) : the_post(); 

				thematic_abovepost(); ?&#38;gt;

				&#38;lt;div id=&#38;quot;post-&#38;lt;?php the_ID(); ?&#38;gt;&#38;quot; class=&#38;quot;&#38;lt;?php thematic_post_class(); ?&#38;gt;&#38;quot;&#38;gt;
	    			&#38;lt;?php thematic_postheader(); ?&#38;gt;
					&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;
				&#38;lt;?php thematic_content(); ?&#38;gt;
					&#38;lt;/div&#38;gt;&#38;lt;!-- .entry-content --&#38;gt;
					&#38;lt;?php thematic_postfooter(); ?&#38;gt;
				&#38;lt;/div&#38;gt;&#38;lt;!-- #post --&#38;gt;
			&#38;lt;?php 

				thematic_belowpost();

		endwhile;
	}
} // end category_loop

function childtheme_override_category_loop() {
		echo my_conditional_category_loop();
}&#60;/code&#62;&#60;/pre&#62;
&#60;/blockquote&#62;</description>
</item>
<item>
<title>ridgely on "Conditional childtheme_override"</title>
<link>http://themeshaper.com/forums/topic/conditional-childtheme_override#post-15417</link>
<pubDate>Tue, 07 Sep 2010 01:47:53 +0000</pubDate>
<dc:creator>ridgely</dc:creator>
<guid isPermaLink="false">15417@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;So I put this in my functions file:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;function my_conditional_category_loop() {
	global $post;
	if (is_category(&#38;#39;drawing&#38;#39;) &#124;&#124; is_category(&#38;#39;painting&#38;#39;)) {
		function childtheme_override_category_loop() {
	 	while ( have_posts()) : the_post() // Start the loop:
		?&#38;gt;
		&#38;lt;div id=&#38;quot;post-&#38;lt;?php the_ID() ?&#38;gt;&#38;quot; class=&#38;quot;&#38;lt;?php thematic_post_class()?&#38;gt;&#38;quot;&#38;gt;
		&#38;lt;?php thematic_postheader(); ?&#38;gt;
		&#38;lt;?php get_the_image( array(&#38;#39;custom_key&#38;#39; =&#38;gt; array( &#38;#39;Thumbnail&#38;#39;,&#38;#39;thumbnail&#38;#39;	),&#38;#39;default_size&#38;#39; =&#38;gt; &#38;#39;thumbnail&#38;#39; ) ); ?&#38;gt;
		&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;
		&#38;lt;?php	thematic_content();?&#38;gt;
		&#38;lt;/div&#38;gt;
		&#38;lt;?php thematic_postfooter(); ?&#38;gt;
		&#38;lt;/div&#38;gt;&#38;lt;!-- .post --&#38;gt;
		&#38;lt;?php endwhile; // loop done, go back up
		}
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;While the category pages that *aren't* drawing or painting came out ok, the &#60;code&#62;category-drawing&#60;/code&#62; and &#60;code&#62;category-painting&#60;/code&#62; pages came up with the &#60;code&#62;page-title&#60;/code&#62; and &#60;code&#62;archive-meta&#60;/code&#62;, period. These category posts are set with css to hide everything but the thumbnail, which should have been created per the function above. But no luck. What am I missing?
&#60;/p&#62;</description>
</item>
<item>
<title>em hr on "Conditional childtheme_override"</title>
<link>http://themeshaper.com/forums/topic/conditional-childtheme_override#post-15416</link>
<pubDate>Tue, 07 Sep 2010 01:08:20 +0000</pubDate>
<dc:creator>em hr</dc:creator>
<guid isPermaLink="false">15416@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;The else is not necessary either.&#60;/p&#62;
&#60;p&#62;The override won't come into play if the condition is not met. So in that case we will fall back to the parent function regardless.&#60;/p&#62;
&#60;p&#62;Test it out :)
&#60;/p&#62;</description>
</item>
<item>
<title>ridgely on "Conditional childtheme_override"</title>
<link>http://themeshaper.com/forums/topic/conditional-childtheme_override#post-15414</link>
<pubDate>Tue, 07 Sep 2010 00:39:04 +0000</pubDate>
<dc:creator>ridgely</dc:creator>
<guid isPermaLink="false">15414@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;By out I was thinking more of&#60;br /&#62;
...`else {&#60;br /&#62;
 return thematic_categoryloop();&#60;br /&#62;
 }`&#60;/p&#62;
&#60;p&#62;If the &#60;code&#62;else&#60;/code&#62; statememt is necessary, then good to know. If the add_action is *not* necessary, then how/where does one insert &#60;code&#62;my_conditional_category_loop&#60;/code&#62;? Or does the &#60;code&#62;global $post;&#60;/code&#62; take care of that problem?&#60;/p&#62;
&#60;p&#62;You guys are great - so patient with the baby who learns by cut-and-paste. :)
&#60;/p&#62;</description>
</item>
<item>
<title>em hr on "Conditional childtheme_override"</title>
<link>http://themeshaper.com/forums/topic/conditional-childtheme_override#post-15413</link>
<pubDate>Tue, 07 Sep 2010 00:17:34 +0000</pubDate>
<dc:creator>em hr</dc:creator>
<guid isPermaLink="false">15413@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;If by &#34;out&#34; you mean:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_action (my_conditional_category_loop, thematic_categoryloop);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;No, the add action is not necessary.
&#60;/p&#62;</description>
</item>
<item>
<title>em hr on "Conditional childtheme_override"</title>
<link>http://themeshaper.com/forums/topic/conditional-childtheme_override#post-15412</link>
<pubDate>Mon, 06 Sep 2010 23:51:07 +0000</pubDate>
<dc:creator>em hr</dc:creator>
<guid isPermaLink="false">15412@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;In case you check back. I updated some errors in the code above.
&#60;/p&#62;</description>
</item>
<item>
<title>ridgely on "Conditional childtheme_override"</title>
<link>http://themeshaper.com/forums/topic/conditional-childtheme_override#post-15411</link>
<pubDate>Mon, 06 Sep 2010 23:49:10 +0000</pubDate>
<dc:creator>ridgely</dc:creator>
<guid isPermaLink="false">15411@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Cool! Thank you! Do I need to build an &#34;out&#34; for this? I.e.&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;function my_conditional_category_loop() {
	global $post;

	if ( is_category(&#38;#39;drawing&#38;#39;) ) {
		function childtheme_override_category_loop() {
	 	 while ( have_posts()) : the_post() // Start the loop:
?&#38;gt;
		&#38;lt;div id=&#38;quot;post-&#38;lt;?php the_ID() ?&#38;gt;&#38;quot; class=&#38;quot;&#38;lt;?php thematic_post_class()?&#38;gt;&#38;quot;&#38;gt;
		&#38;lt;?php thematic_postheader(); ?&#38;gt;
		&#38;lt;?php get_the_image( array(&#38;#39;custom_key&#38;#39; =&#38;gt; array( &#38;#39;Thumbnail&#38;#39;,&#38;#39;thumbnail&#38;#39;	),&#38;#39;default_size&#38;#39; =&#38;gt; &#38;#39;thumbnail&#38;#39; ) ); ?&#38;gt;
		&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;
		&#38;lt;?php	thematic_content();?&#38;gt;
		&#38;lt;/div&#38;gt;
		&#38;lt;?php thematic_postfooter(); ?&#38;gt;
		&#38;lt;/div&#38;gt;&#38;lt;!-- .post --&#38;gt;
		&#38;lt;?php endwhile; // loop done, go back up
		} else {
                return thematic_categoryloop();
		}
}

add action (my_conditional_category_loop, thematic_categoryloop);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Or am I wayy offtrack?
&#60;/p&#62;</description>
</item>
<item>
<title>em hr on "Conditional childtheme_override"</title>
<link>http://themeshaper.com/forums/topic/conditional-childtheme_override#post-15410</link>
<pubDate>Mon, 06 Sep 2010 23:47:38 +0000</pubDate>
<dc:creator>em hr</dc:creator>
<guid isPermaLink="false">15410@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hi Ridgley,&#60;/p&#62;
&#60;p&#62;The very existence of an override function removes the parent function. If you want to use the override conditionally then you will need the condition to precede the child override function like so:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if ( is_category(&#38;#39;drawing&#38;#39;) ) {
	function childtheme_override_category_loop() {
	  // do something
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Depending on which parent function you are overriding and the point of that parent function is executed, you may or may not need to load a global variable such as &#60;code&#62;global $post&#60;/code&#62;. So generally it may be best to wrap the whole condition in a function and call the global variable that you might need.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function my_conditional_*() {
	global $post;

	if ( is_*() ) ) {
		function childtheme_override_*() {
	 	 // do something
		}
	}
}&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>ridgely on "Conditional childtheme_override"</title>
<link>http://themeshaper.com/forums/topic/conditional-childtheme_override#post-15408</link>
<pubDate>Mon, 06 Sep 2010 22:45:09 +0000</pubDate>
<dc:creator>ridgely</dc:creator>
<guid isPermaLink="false">15408@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;(Building from 0.9.7.4 rev709)&#60;br /&#62;
If you want a conditional &#60;code&#62;childtheme_override&#60;/code&#62;, for example, you want to use the &#60;code&#62;childtheme_override_category_loop&#60;/code&#62; only on certain category pages, where does the condition need to occur. I tried inserting the condition within the &#60;code&#62;childtheme_override&#60;/code&#62; but that didn't work entirely as intended, i.e. it affected ALL my category pages:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;/*Custom Category Loop for certain Categories*/
function childtheme_override_category_loop() {
		if (is_category(&#38;#39;drawing&#38;#39;)&#124;&#124; is_category(&#38;#39;painting&#38;#39;)) {
	 	while ( have_posts()	)	:	the_post()	// Start the loop:
?&#38;gt;
		&#38;lt;div id=&#38;quot;post-&#38;lt;?php	the_ID() ?&#38;gt;&#38;quot; class=&#38;quot;&#38;lt;?php	thematic_post_class()	?&#38;gt;&#38;quot;&#38;gt;
				&#38;lt;?php	thematic_postheader(); ?&#38;gt;
				&#38;lt;?php	get_the_image( array(	&#38;#39;custom_key&#38;#39; =&#38;gt;	array( &#38;#39;Thumbnail&#38;#39;,	&#38;#39;thumbnail&#38;#39;	), &#38;#39;default_size&#38;#39;	=&#38;gt; &#38;#39;thumbnail&#38;#39; ) );	?&#38;gt;
				&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;
		&#38;lt;?php	thematic_content();	?&#38;gt;
				&#38;lt;/div&#38;gt;
				&#38;lt;?php	thematic_postfooter(); ?&#38;gt;
		&#38;lt;/div&#38;gt;&#38;lt;!-- .post --&#38;gt;
		&#38;lt;?php	endwhile;	// loop	done,	go back	up
		}
	}&#60;/code&#62;&#60;/pre&#62;</description>
</item>

</channel>
</rss>
