Help with hack to exclude category
-
I’ve got this code in my sidebar.php file. It determines what categories have been assigned to the current post, and then shows 10 headlines from each category in a list. I need to figure out how to make it exclude a specific category number (not list the headlines from that category) and just display lists for the remaining categories.
This is what I am working with.
<?php // this is where 10 headlines from the current category get printed global $post; $categories = get_the_category(); foreach ($categories as $category) : ?> <li><h2>The Latest From This Topic</h2> <ul class="bullets"> <?php $posts = get_posts('numberposts=10&category='. $category->term_id); foreach($posts as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> </li> <?php endforeach; ?>
I hope I have given enough information here to explain what I’m trying to accomplish, and I appreciate any help you can offer.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Help with hack to exclude category’ is closed to new replies.