Showing Last 5 Posts In a Specific Category In Sidebar
-
Hi,
I am attempting to show the last five posts from a specific category in my sidebar. I trouble-shot some code in my locally hosted mock site, and nothing seemed to work! Presently, the code I have implemented is doing everything I want it to: displaying thumbnails, linking to posts, showing the last 5…but they’re the last 5 most recent posts, not the last five most recent posts from my “reviews” category. Here’s the code:
<img src="https://8bitfoundation.com/wp-content/uploads/2013/03/RecentReviews.jpg"></a> <ul id="meta" class="widget-container"> <h4 class="widget-title"><?php _e( '', 'twentyten' ); ?></h3> <p> </p> <?php $the_query = new WP_Query('showposts=5&orderby=post_date&order=desc&reviews=reviews'); while ($the_query->have_posts()) : $the_query->the_post(); ?> <div class="twentyten-featured-post"> <?php the_post_thumbnail(array(85,85), array ('class' => 'alignleft')); ?> <a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a> <div class="clear"></div> </div> <?php endwhile; ?> <?php wp_reset_query(); ?> </ul>
The image up top is not the problem – that’s the introductory header for the unordered list. I’m thinking the problem lies in “(‘showposts=5&orderby=post_date&order=desc&reviews=reviews’);” but am not entirely sure. Can someone please help? My website is 8bitfoundation.com.
- The topic ‘Showing Last 5 Posts In a Specific Category In Sidebar’ is closed to new replies.