in_category not working on front page
-
O.K. I really did try to use the search function but I must be search-function-challenged because I could never get it to do more than pull up the stuff I’d already read in the Codex.
Anyway, so I’m using in_category(‘category_id’) in my code as I have on other blogs in the past successfully. I want to do a different css if one of the categories is “featured” or 20.
This seems to work when the site is on an individual post (there is no separate single post page) but when you are on the main index, it seems to miss the category.
Here’s the code I’m using:
<?php if (is_single()) : ?>
<div class="postsingle" id="post-<?php the_ID(); ?>">
<?php else : ?>
<div class="post" id="post-<?php the_ID(); ?>">
<?php endif; ?>
<?php if ( in_category('20') ) : ?>
<div class="titolofeatured">
<?php else : ?>
<div class="titolopost">
<?php endif; ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>Here’s the link to the page The Naked Truth. “The Conspiracy Superstition” half way down is a “featured” post.
What am I missing? I know it’s something small and embarrassing. ??
Thanks in advance!
- The topic ‘in_category not working on front page’ is closed to new replies.