Recent Posts – Exclude a Category
-
I’m trying to exclude the posts of a certain category from the recent posts list. Since wp_get_archives does not have that kind of argument, I’m trying the following:
<?php $posts = get_posts('numberposts=20&category=-65'); foreach($posts as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?>
I cant quite see if it works since it turns the sorting up side down (From first to last post)
So I tried to set explicit sorting:
<?php $posts = get_posts('numberposts=20&category=-65&order=DESC&orderby=ID'); foreach($posts as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?>
Still up side down!
Any ideas?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Recent Posts – Exclude a Category’ is closed to new replies.