<?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 statement to show one of two possible query_posts()</title>
<link>http://themeshaper.com/forums/</link>
<description>Help In Shaping WordPress Themes</description>
<language>en</language>
<pubDate>Wed, 22 May 2013 08:32:43 +0000</pubDate>

<item>
<title>sixfootjames on "Conditional statement to show one of two possible query_posts()"</title>
<link>http://themeshaper.com/forums/topic/conditional-statement-to-show-one-of-two-possible-query_posts#post-25825</link>
<pubDate>Sun, 11 Mar 2012 15:57:32 +0000</pubDate>
<dc:creator>sixfootjames</dc:creator>
<guid isPermaLink="false">25825@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hi all,&#60;/p&#62;
&#60;p&#62;I have created a specific template page that needs to show the content of one of two categories.&#60;/p&#62;
&#60;p&#62;I am not sure if I should be doing this in the functions.php file because I am not sure how to hook the functions.php file up to this specific template page. What I need is a conditional statement, that will check if we are in a particular category. &#60;/p&#62;
&#60;p&#62;Here's the working code for one category&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;
        &#38;lt;h1&#38;gt;&#38;lt;?php  the_title(); ?&#38;gt; &#38;lt;/h1&#38;gt;
        &#38;lt;?php query_posts(&#38;#39;cat=5&#38;#38;posts_per_page=4&#38;#39;);
            if (have_posts()) : while (have_posts()) : the_post();?&#38;gt;
            &#38;lt;h2&#38;gt;&#38;lt;?php the_title();?&#38;gt;&#38;lt;/h2&#38;gt;
            &#38;lt;?php
                global $more;
                $more = 0;
                the_content();
                endwhile; endif;
                // Reset Query
                wp_reset_query();
            ?&#38;gt;

&#38;lt;/div&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;What I need is something like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;div class=&#38;quot;entry-content&#38;quot;&#38;gt;
if (category == &#38;#39;category1&#38;#39;)
{

        &#38;lt;h1&#38;gt;&#38;lt;?php  the_title(); ?&#38;gt; &#38;lt;/h1&#38;gt;
        &#38;lt;?php query_posts(&#38;#39;cat=5&#38;#38;posts_per_page=4&#38;#39;);
            if (have_posts()) : while (have_posts()) : the_post();?&#38;gt;
            &#38;lt;h2&#38;gt;&#38;lt;?php the_title();?&#38;gt;&#38;lt;/h2&#38;gt;
            &#38;lt;?php
                global $more;
                $more = 0;
                the_content();
                endwhile; endif;
                // Reset Query
                wp_reset_query();
            ?&#38;gt;

} else if (category == &#38;#39;category2&#38;#39;)
{

        &#38;lt;h1&#38;gt;&#38;lt;?php  the_title(); ?&#38;gt; &#38;lt;/h1&#38;gt;
        &#38;lt;?php query_posts(&#38;#39;cat=6&#38;#38;posts_per_page=4&#38;#39;);
            if (have_posts()) : while (have_posts()) : the_post();?&#38;gt;
            &#38;lt;h2&#38;gt;&#38;lt;?php the_title();?&#38;gt;&#38;lt;/h2&#38;gt;
            &#38;lt;?php
                global $more;
                $more = 0;
                the_content();
                endwhile; endif;
                // Reset Query
                wp_reset_query();
            ?&#38;gt;

}
&#38;lt;/div&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Helga, if you are the first to answer, I know we are going through a similar exercise but this one is not related ;) This one is specific to this template problem I am having. :)
&#60;/p&#62;</description>
</item>

</channel>
</rss>
