CSS based on category
-
Hi-
I am trying to work through an issue and need some help.
I have my homepage that requires me to exclude some categories in the listing. See this code:
<?php if (is_home()) { query_posts("cat=-17, -7, -6, -18"); } ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?>
Additionally, I have a specific category that needs different css styling from the other posts. But, because I utilize the links that filter posts (https://address.com/hihf/?tag=new), I can NOT add another query like this:
<?php $my_query = new WP_Query('cat=6'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
The reason is it keeps the new query posts when I visit the filtered links: https://address.com/hihf/?tag=new.
How can I have two differently styled posts dependent on the category all within the same main loop?
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘CSS based on category’ is closed to new replies.