in_category(category_id) is not working.
-
For some reason, no matter what I try, I cannot get in_category(category_id) to work. On my index.php page, I want to display only one category of posts in the loop. I’ve read as much as I can about the topic, tried numerous things, but nothing works. All that happens is that it continues to display posts from all categories that then bleed into the sidebar and mess up my layout. Any ideas?
Here’s my loop code:
<div class="content"> <div class="leftcontent"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php if (!in_category($il_asides_cat) ) { ?> <div class="post one" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><?php if ($il_more_authors == "True") { ?> <span class="chrondate"><?php the_author_posts_link('nickname') ?></span><?php } ?></h2>posted on <?php the_date() ?> / <?php the_time() ?> <br /> <?php the_tags(); ?></p></div> <div class="entry"> <?php the_content("[more]"); ?> <p> <?php comments_popup_link('comment', '1 comment', '% comments'); ?> </div><!-- end entry --> </div> <?php } else { ?> <div class="post aside" id="post-<?php the_ID(); ?>" style="padding-bottom:0em;"> <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> <span class="chrondate"><?php the_author_posts_link('nickname') ?></span></h3> <div class="entry"> <?php the_content("[...]"); ?> </div><!-- end entry --> </div> <?php } endwhile; ?> </div> <?php else : ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘in_category(category_id) is not working.’ is closed to new replies.