At http://www.overturemarketplace.com
I'm trying to make it so that the recent posts only shows 5, but using 'showposts=5' in the code doesn't work. The guys who customized this theme used a custom query which they were able to get only 5 posts to show, but the issue is that we've added a News category and do not want news showing up under Recent Posts, so I added a more standard recent posts code which effectively removes the unwanted category, but it ignores the showposts parameter.
Here is the code used currently:
<h4>Recent Posts</h4>
<ul>
<?php $temp_query = $wp_query; query_posts('showposts=5&cat=-74'); //ejm exclude category 74 ?>
<?php while (have_posts()) { the_post(); ?>
<li><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to “<?php the_title(); ?>”"><?php the_title(); ?></a></li>
<?php } $wp_query = $temp_query; ?>
</ul>
As you see at the page, 9 posts are showing (bizarre). Nothing is in order, either.
Here is the code the guys who originally did the theme used, but again, this code doesn't exclude category 74 which is important.
<?php
$recent_posts = $wpdb->get_results("SELECT id,post_title FROM {$wpdb->prefix}posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date DESC LIMIT 0,5");
foreach($recent_posts as $post) {
print "<li><a href='". get_permalink($post->id) ."'>".$post->post_title."</a></li>\n";
}
?>
Any thoughts? Much appreciated.