<?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: a loop that runs only on one category archive</title>
<link>http://themeshaper.com/forums/</link>
<description>Help In Shaping WordPress Themes</description>
<language>en</language>
<pubDate>Tue, 21 May 2013 18:26:15 +0000</pubDate>

<item>
<title>colfelt on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26695</link>
<pubDate>Sat, 28 Apr 2012 14:05:13 +0000</pubDate>
<dc:creator>colfelt</dc:creator>
<guid isPermaLink="false">26695@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Ahh, that old chestnut...
&#60;/p&#62;</description>
</item>
<item>
<title>helgatheviking on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26693</link>
<pubDate>Sat, 28 Apr 2012 13:52:41 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">26693@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;no bacon is very unsatisfactory.  always more than 1 way to skin the cat b/c we could probably go back to what you started with&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function remove_thematic_categoryloop() {
	remove_action(&#38;#39;thematic_categoryloop&#38;#39;, &#38;#39;thematic_category_loop&#38;#39;);
}
add_action(&#38;#39;init&#38;#39;, &#38;#39;remove_thematic_categoryloop&#38;#39;);

function kia_categoy_loop(){
   if(is_category(&#38;#39;bacon&#38;#39;)){
       //bacon loop here
   } else {
       thematic_category_loop();
   }
add_action(&#38;#39;thematic_categoryloop&#38;#39;,&#38;#39;kia_category_loop&#38;#39;);&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>colfelt on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26692</link>
<pubDate>Sat, 28 Apr 2012 10:26:38 +0000</pubDate>
<dc:creator>colfelt</dc:creator>
<guid isPermaLink="false">26692@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Ah, yes. That's better. I figured there must've been a walking donut there. That loop had completely disappeared up it's own rear. And it didn't have ANY bacon in it, which is, well, unsatisfactory.&#60;/p&#62;
&#60;p&#62;As ever, Helga, thank you. You're awesome. :)
&#60;/p&#62;</description>
</item>
<item>
<title>helgatheviking on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26655</link>
<pubDate>Thu, 26 Apr 2012 01:50:56 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">26655@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;not bacon!  :)  well i have to apologize b/c i think i messed up.  &#60;/p&#62;
&#60;p&#62;basically thematic does this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if (function_exists(&#38;#39;childtheme_override_category_loop&#38;#39;))  {
	function thematic_category_loop() {
		childtheme_override_category_loop();
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;so if the override is defined then thematic's default becomes the override.  which means the original thematic_category_loop doesn't exist anymore and you just end up in a loop of loops.  &#60;/p&#62;
&#60;p&#62;my else statement&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;else { thematic_category_loop() }&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;is just pointing to childtheme_override_category_loop which points to thematic_category_loop and on and on.  &#60;/p&#62;
&#60;p&#62;so the override should be&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function childtheme_override_category_loop(){
  if(is_category(&#38;#39;bacon&#38;#39;)){
       //put your special bacon loop here
  } else {
      //put default category loop here
  }
}&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>colfelt on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26653</link>
<pubDate>Wed, 25 Apr 2012 23:04:04 +0000</pubDate>
<dc:creator>colfelt</dc:creator>
<guid isPermaLink="false">26653@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Yeah I'm using 0.9.8, but no joy. Ah well, the less streamlined version is working OK. It just bugs me that something that *should* work, doesn't. It's just not bacon.
&#60;/p&#62;</description>
</item>
<item>
<title>helgatheviking on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26629</link>
<pubDate>Wed, 25 Apr 2012 13:26:49 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">26629@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;can't see anything in your code, but first off make sure you are using this version of thematic:&#60;br /&#62;
developing.thematic4you.com/thematic-development-release/&#60;/p&#62;
&#60;p&#62;as there were some problems w/ the add_action that got resolved.
&#60;/p&#62;</description>
</item>
<item>
<title>colfelt on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26621</link>
<pubDate>Wed, 25 Apr 2012 05:17:41 +0000</pubDate>
<dc:creator>colfelt</dc:creator>
<guid isPermaLink="false">26621@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;OK... so I've been working with Helga's cleaner code. But, It's not playing nicely with me. I find that the two loops I have defined in it work fine. But then the normal thematic_category_loop doesn't seem to work. The categories that should run that loop don't seem to run any loop at all. So, it made me wonder, doesn't specifying childtheme_override_category_loop tell the original thematic_category_loop to go use childtheme_override_category_loop instead? Therefore, flying up it's own backside? Maybe it doesn't work that way. But it was the best explanation I could come up with to explain why the code below didn't work. Can you spot anything that looks like it would prevent the thematic_category_loop from working?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// remove the standard loop

function childtheme_override_category_loop(){

// get the name of the category and store it in the variable $catslug
  $cat = get_query_var(&#38;#39;cat&#38;#39;);
  $yourcat = get_category ($cat);
  $catslug = $yourcat-&#38;gt;slug;

if (is_category(&#38;#39;testimonials&#38;#39;)){
 query_posts(&#38;#39;category_name=&#38;#39;.$catslug);
 if (have_posts()) : while (have_posts()) : the_post();  ?&#38;gt;

&#38;lt;h1 class=&#38;quot;entry-title&#38;quot;&#38;gt;&#38;lt;?php the_title(); ?&#38;gt;&#38;lt;/h1&#38;gt;
&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;&#38;lt;?php the_content(); ?&#38;gt;&#38;lt;/div&#38;gt;

&#38;lt;?php endwhile; endif;
}
elseif (is_category(&#38;#39;menus&#38;#39;)) {
// loop for the content within the current category,
// which has a custom field &#38;#39;intro_article&#38;#39; which is equal to 1
$handmade_query = new WP_Query(&#38;#39;category_name=&#38;#39;.$catslug.&#38;#39;&#38;#38;meta_key=intro_article&#38;#38;meta_value=1&#38;#39;);
while ($handmade_query-&#38;gt;have_posts()) : $handmade_query-&#38;gt;the_post();  ?&#38;gt;

&#38;lt;h1 class=&#38;quot;entry-title&#38;quot;&#38;gt;&#38;lt;?php the_title(); ?&#38;gt;&#38;lt;/h1&#38;gt;
&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;&#38;lt;?php the_content(); ?&#38;gt;&#38;lt;/div&#38;gt;

&#38;lt;?php endwhile;
wp_reset_postdata(); ?&#38;gt;

&#38;lt;?php
// now loop to create an unordered list of the other posts in the category
// but which have a custom field &#38;#39;intro_article&#38;#39; which is equal to 0
?&#38;gt;
&#38;lt;ul id=&#38;quot;sub-nav-ul&#38;quot;&#38;gt;
&#38;lt;?php
 query_posts(&#38;#39;category_name=&#38;#39;.$catslug.&#38;#39;&#38;#38;meta_key=intro_article&#38;#38;meta_value=0&#38;#39;);
 if (have_posts()) : while (have_posts()) : the_post();  ?&#38;gt;

 &#38;lt;li id=&#38;quot;sub-nav&#38;quot; class=&#38;quot;entry-title&#38;quot;&#38;gt;&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot; rel=&#38;quot;bookmark&#38;quot; title=&#38;quot;Permanent Link to &#38;lt;?php the_title_attribute(); ?&#38;gt;&#38;quot;&#38;gt; &#38;lt;?php the_post_thumbnail(array(70,70));?&#38;gt;&#38;lt;span&#38;gt;&#38;lt;?php the_title(); ?&#38;gt;&#38;lt;/span&#38;gt;&#38;lt;/a&#38;gt;&#38;lt;/li&#38;gt;

&#38;lt;?php endwhile; endif; ?&#38;gt;&#38;lt;/ul&#38;gt; &#38;lt;?php
wp_reset_postdata();

} else {
      thematic_category_loop();
  }
}&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>colfelt on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26620</link>
<pubDate>Wed, 25 Apr 2012 04:58:26 +0000</pubDate>
<dc:creator>colfelt</dc:creator>
<guid isPermaLink="false">26620@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Cool beans. Thanks Helga!
&#60;/p&#62;</description>
</item>
<item>
<title>helgatheviking on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26618</link>
<pubDate>Wed, 25 Apr 2012 03:46:28 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">26618@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;you got it.  everything is better with bacon.  yes, look through the extensions folder.  you'll see plenty of places where it is set up to run childtheme_override_whatever in place of thematic_whatever.  the overrides are far more intuitive than filters, but not always the best solution.  usually depends on how much you need to change... or if there is a filter available.
&#60;/p&#62;</description>
</item>
<item>
<title>helgatheviking on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26617</link>
<pubDate>Wed, 25 Apr 2012 03:46:28 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">26617@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;you got it.  everything is better with bacon.  yes, look through the extensions folder.  you'll see plenty of places where it is set up to run childtheme_override_whatever in place of thematic_whatever.  the overrides are far more intuitive than filters, but not always the best solution.  usually depends on how much you need to change... or if there is a filter available.
&#60;/p&#62;</description>
</item>
<item>
<title>colfelt on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26613</link>
<pubDate>Wed, 25 Apr 2012 00:30:47 +0000</pubDate>
<dc:creator>colfelt</dc:creator>
<guid isPermaLink="false">26613@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Well, clearly that's much more elegant. And anything that has bacon in it has to be good, right?&#60;/p&#62;
&#60;p&#62;So, the function childtheme_override_whateverfunction. That can be used to? Let me guess, override any function you can find that says thematic_whateverfunction?
&#60;/p&#62;</description>
</item>
<item>
<title>helgatheviking on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26598</link>
<pubDate>Tue, 24 Apr 2012 15:02:52 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">26598@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;as a general set up what about:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function childtheme_override_category_loop(){
  if(is_category(&#38;#39;bacon&#38;#39;)){
       //put your special bacon loop here
  } else {
      thematic_category_loop();
  }
}&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>colfelt on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26595</link>
<pubDate>Tue, 24 Apr 2012 12:48:02 +0000</pubDate>
<dc:creator>colfelt</dc:creator>
<guid isPermaLink="false">26595@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;OK... I think I have it. Just in case someone else may find this helpful I'm pasting the code below.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// remove the standard loop

function remove_thematic_categoryloop() {
	remove_action(&#38;#39;thematic_categoryloop&#38;#39;, &#38;#39;thematic_category_loop&#38;#39;);
}
add_action(&#38;#39;init&#38;#39;, &#38;#39;remove_thematic_categoryloop&#38;#39;);

// get the name of the category and store it in the variable $catslug
function add_handmade_intro_categoryloop() {
if (is_category( )) {
  $cat = get_query_var(&#38;#39;cat&#38;#39;);
  $yourcat = get_category ($cat);
  $catslug = $yourcat-&#38;gt;slug;

// if this isn&#38;#39;t in the menus category, do a normal loop
if (!is_category(&#38;#39;menus&#38;#39;)){
 query_posts(&#38;#39;category_name=&#38;#39;.$catslug);
 if (have_posts()) : while (have_posts()) : the_post();  ?&#38;gt;

 &#38;lt;h1 class=&#38;quot;entry-title&#38;quot;&#38;gt;&#38;lt;?php the_title(); ?&#38;gt;&#38;lt;/h1&#38;gt;
&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;&#38;lt;?php the_content(); ?&#38;gt;&#38;lt;/div&#38;gt;

&#38;lt;?php endwhile; endif;
wp_reset_postdata();
}

// if it is in the category &#38;#39;menus&#38;#39; then do these special loops
if (is_category(&#38;#39;menus&#38;#39;)) {

// loop for the content within the current category,
// which has a custom field &#38;#39;intro_article&#38;#39; which is equal to 1
$handmade_query = new WP_Query(&#38;#39;category_name=&#38;#39;.$catslug.&#38;#39;&#38;#38;meta_key=intro_article&#38;#38;meta_value=1&#38;#39;);
while ($handmade_query-&#38;gt;have_posts()) : $handmade_query-&#38;gt;the_post();  ?&#38;gt;

&#38;lt;h1 class=&#38;quot;entry-title&#38;quot;&#38;gt;&#38;lt;?php the_title(); ?&#38;gt;&#38;lt;/h1&#38;gt;
&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;&#38;lt;?php the_content(); ?&#38;gt;&#38;lt;/div&#38;gt;

&#38;lt;?php endwhile;
wp_reset_postdata(); ?&#38;gt;

&#38;lt;?php
// now loop to create an unordered list of the other posts in the category
// but which have a custom field &#38;#39;intro_article&#38;#39; which is equal to 0
?&#38;gt;
&#38;lt;ul id=&#38;quot;sub-nav-ul&#38;quot;&#38;gt;
&#38;lt;?php
 query_posts(&#38;#39;category_name=&#38;#39;.$catslug.&#38;#39;&#38;#38;meta_key=intro_article&#38;#38;meta_value=0&#38;#39;);
 if (have_posts()) : while (have_posts()) : the_post();  ?&#38;gt;

 &#38;lt;li id=&#38;quot;sub-nav&#38;quot; class=&#38;quot;entry-title&#38;quot;&#38;gt;&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot; rel=&#38;quot;bookmark&#38;quot; title=&#38;quot;Permanent Link to &#38;lt;?php the_title_attribute(); ?&#38;gt;&#38;quot;&#38;gt; &#38;lt;?php the_post_thumbnail(array(70,70));?&#38;gt;&#38;lt;span&#38;gt;&#38;lt;?php the_title(); ?&#38;gt;&#38;lt;/span&#38;gt;&#38;lt;/a&#38;gt;&#38;lt;/li&#38;gt;

&#38;lt;?php endwhile; endif; ?&#38;gt;&#38;lt;/ul&#38;gt; &#38;lt;?php
}
}
}
add_action(&#38;#39;thematic_categoryloop&#38;#39;, &#38;#39;add_handmade_intro_categoryloop&#38;#39;);&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>colfelt on "a loop that runs only on one category archive"</title>
<link>http://themeshaper.com/forums/topic/a-loop-that-runs-only-on-one-category-archive#post-26591</link>
<pubDate>Tue, 24 Apr 2012 10:39:22 +0000</pubDate>
<dc:creator>colfelt</dc:creator>
<guid isPermaLink="false">26591@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hi all,&#60;/p&#62;
&#60;p&#62;I am trying to call a function/loop specific to one category archive page. What I've done, is to remove the standard loop within my child-theme's functions.php, then replaced it with my 'special' loop.&#60;/p&#62;
&#60;p&#62;So far, I have cracked getting that 'special' loop to work nicely. But what I want to do now, is to only run the function which rips out the normal loop when we are on the category archive of a particular category ('menus').&#60;/p&#62;
&#60;p&#62;Here's my code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// remove the standard loop
function remove_thematic_categoryloop() {
	remove_action(&#38;#39;thematic_categoryloop&#38;#39;, &#38;#39;thematic_category_loop&#38;#39;);
}
add_action(&#38;#39;init&#38;#39;, &#38;#39;remove_thematic_categoryloop&#38;#39;);

// get the name of the category and store it in the variable $catslug
function add_handmade_intro_categoryloop() {
if (is_category( )) {
  $cat = get_query_var(&#38;#39;cat&#38;#39;);
  $yourcat = get_category ($cat);
  $catslug = $yourcat-&#38;gt;slug;

// loop for the content within the current category,
// which has a custom field &#38;#39;intro_article&#38;#39; which is equal to 1
$handmade_query = new WP_Query(&#38;#39;category_name=&#38;#39;.$catslug.&#38;#39;&#38;#38;meta_key=intro_article&#38;#38;meta_value=1&#38;#39;);
while ($handmade_query-&#38;gt;have_posts()) : $handmade_query-&#38;gt;the_post();  ?&#38;gt;

&#38;lt;h1 class=&#38;quot;entry-title&#38;quot;&#38;gt;&#38;lt;?php the_title(); ?&#38;gt;&#38;lt;/h1&#38;gt;
&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;&#38;lt;?php the_content(); ?&#38;gt;&#38;lt;/div&#38;gt;

&#38;lt;?php endwhile;
wp_reset_postdata(); ?&#38;gt;

&#38;lt;?php
// now loop to create an unordered list of the other posts in the category
// but which have a custom field &#38;#39;intro_article&#38;#39; which is equal to 0
?&#38;gt;
&#38;lt;ul id=&#38;quot;sub-nav-ul&#38;quot;&#38;gt;
&#38;lt;?php
 query_posts(&#38;#39;category_name=&#38;#39;.$catslug.&#38;#39;&#38;#38;meta_key=intro_article&#38;#38;meta_value=0&#38;#39;);
 if (have_posts()) : while (have_posts()) : the_post();  ?&#38;gt;

 &#38;lt;li id=&#38;quot;sub-nav&#38;quot; class=&#38;quot;entry-title&#38;quot;&#38;gt;&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot; rel=&#38;quot;bookmark&#38;quot; title=&#38;quot;Permanent Link to &#38;lt;?php the_title_attribute(); ?&#38;gt;&#38;quot;&#38;gt; &#38;lt;?php the_post_thumbnail(array(70,70));?&#38;gt;&#38;lt;span&#38;gt;&#38;lt;?php the_title(); ?&#38;gt;&#38;lt;/span&#38;gt;&#38;lt;/a&#38;gt;&#38;lt;/li&#38;gt;

&#38;lt;?php endwhile; endif; ?&#38;gt;&#38;lt;/ul&#38;gt; &#38;lt;?php
}
}
add_action(&#38;#39;thematic_categoryloop&#38;#39;, &#38;#39;add_handmade_intro_categoryloop&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;So, I've tried to put in some &#34;if (is_category('menus'))&#34; stuff in before the function, which didn't work... and I have subsequently hit a wall and need some inspiration. I only want to call these functions if the category is 'menus'...&#60;/p&#62;
&#60;p&#62;Can anybody help me get over this hump? it would save me some hair. Thanks!
&#60;/p&#62;</description>
</item>

</channel>
</rss>
