Having trouble excluding categories on Worpress home page.

1 replies
Hello,

I have been trying to exclude posts from certain categories from appearing in the main section of my home page but I haven't been able to get it right.

The page has two sections where "the loop" is invoked, plus it has three sidebars, a left, a middle, and a right.

The feature section uses the loop, and then the section between the left sidebar and the middle sidebar uses the loop. I would like to exclude the posts that appear in the featured section (cat_ID=1) from appearing in this second loop. You can see my site at Consultant Supply Room | Consultant Supply Room

My "home.php" code is pasted below. Will someone take a look and advise me where to make changes.

Many thanks,
Kirk

Code:
<? include_once('http://consultantsupplyroom.com/traffic/log.php'); ?>
<?php global $wp_theme_options; ?>
<?php get_header(); ?>

<!--Feature Posts-->
<div id="feature" class="clearboth">

    <?php $i = 1; $my_query = "cat=" . $wp_theme_options['feature_cat'] . "&showposts=2"; $my_query = new WP_Query($my_query); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    
    <?php if($i == 1 && image_attachment('feature', 475, 250, FALSE)) { image_attachment('feature', 475, 250); } ?>
    <div class="<?php if ($i == 1) { echo "left"; } elseif ($i == 2) { echo "right"; } ?>">
    
    <h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <!--post meta info-->
	<div class="meta-top">
        <span class="meta-author"><i>by <?php the_author_link(); ?></i></span> <!-- The author's name as a link to his archive -->
        <span class="meta-date"><?php the_time('l \a\t g:i a') ?></span><!-- the timestamp -->
    </div>
    
	<!--post text-->
<!-- Begin KW mod -->
	<!-- p --><!-- ?php nr_content_limit(550,''); ? --><!-- /p -->

	<?php the_content('', 'FALSE', ''); ?>
    <?php if(strstr($post->post_content,'<!--more')) { //if the story has the more tag... ?>
    <div class="post-more">
    <!-- a href="<?php the_permalink(); ?>" --><!-- Want to read more?  Click Here &raquo&raquo; --><!-- /a --></div>
    <?php } ?>
<!-- End KW mod -->


    <div class="post-more"><a href="<?php the_permalink(); ?>">Click here to read more &raquo&raquo;</a></div>

    </div><!--End left or right div-->
    
    <?php if(image_attachment('feature', 475, 250, FALSE)) { break; } ?>
    <?php $i = $i + 1; endwhile; ?>
<div class="clearboth"></div></div>

<!--include sidebar-->
<?php get_template_file('l_sidebar.php'); ?>

<div id="content">

    <!--include tabber-->
    <?php get_template_file('jtabber.php'); ?>

	<?php $q = "cat=-" . $wp_theme_options['feature_cat'] . ",-" . $wp_theme_options['sidenotes_cat'] . "&showposts=3"; query_posts($q); ?>

     <?php if (have_posts()) : while (have_posts()) : the_post(); // the loop ?>

    <div class="post clearboth">
	<!--post title as a link-->
	<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>

    <!--post meta info-->
	<div class="meta-top">
        <span class="meta-author"><i>by <?php the_author_link(); ?></i></span> <!-- The author's name as a link to his archive -->
        <span class="meta-date"><?php the_time('l \a\t g:i a') ?></span><!-- the timestamp -->
    </div>

	<!--post text with the read more link ... sorta-->
	<?php the_content('', 'FALSE', ''); ?>
    <?php if(strstr($post->post_content,'<!--more')) { //if the story has the more tag... ?>
    <div class="post-more"><a href="<?php the_permalink(); ?>">Want to read more?  Click Here &raquo&raquo;</a></div>
    <?php } ?>
    
    </div><!--End post-->
	
	<?php endwhile; // end of one post ?>

	<?php else : // do not delete ?>

	<h3>Page Not Found</h3>
    <p>We're sorry, but the page you are looking for isn't here.</p>
    <p>Try searching for the page you are looking for or using the navigation in the header or sidebar</p>

	<?php endif; // do not delete ?>

<!--index.php end-->
</div>

<!--include m_sidebar-->
<?php get_template_file('m_sidebar.php'); ?>

<!--include r_sidebar-->
<?php get_template_file('r_sidebar.php'); ?>

<!--include footer-->
<?php get_footer(); ?>
#categories #excluding #trouble #worpress
  • Profile picture of the author Kirk Ward
    Solved ... theme appearance setting crapped out. Corrected now.
    Signature
    "We are not here to sell a parcel of boilers and vats, but the potentiality of growing rich beyond the dreams of avarice."

    Dr. Samuel Johnson (Presiding at the sale of Thrales brewery, London, 1781)
    {{ DiscussionBoard.errors[1634223].message }}

Trending Topics