Hello!
I have a static main page where I also display the last five recent posts. I want to exclude specific categories from this list.
This is the code I'm currently using:
<?php
global $post;
$cat=get_cat_ID('top-menu');
$count=0;
$myposts2=get_posts(array('post__not_in'=>get_option('sticky_posts'),'cat'=>-$cat,'showposts'=>5));
foreach($myposts2 as $post) :
$count++; ?>
<li type="circle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach;
if ($count >=10)
?>
It might be pretty messy, I don't know. Where should I change/add the information to exclude a specific category from appearing?
Or if someone is bored/kind enough to clean up what is probably an egregious block of code, I would be most appreciative. Thank you, WordPress community.
I love you all.