cialis online pharmacy generic xenical cheap cialis online cialis generic viagra online in canada buy cheap levitra online cialis without a perscription order viagra uk no prescription flagyl cheap generic levitra buying viagra in the uk cheap viagra approved cialis deltasone online buy viagra online without prescription non prescription cialis buy orlistat uk buy cialis in india prednisone 60 mg female viagra online buy viagra without prescription celebrex prescriptions buy cialis canada best prices viagra alternative to prednisone cheapest generic levitra levitra 5mg cheap viagra cialis on line buy xenical without prescription online accutane canadian health care prednisone no prescreption viagra online generic female viagra europe buy cialis low price cheap india viagra
WordPress Thumb

Display Recent Post Titles Using wp_query

Today, I’d just like to share with everyone this neat WordPress trick by Libby Fisher from Icode4you.net. It’s a short code that will not only let you display the most recent post titles from a certain category but also let you specify how many titles you want displayed.

Below is the code:

<ul>
<?php
global $cat;
$recentPosts = new   WP_Query();
$recentPosts->query('showposts=5&cat=389');
?>
<?php while ($recentPosts->have_posts()) :   $recentPosts->the_post(); ?>
<li><a   href="<?php the_permalink() ?>"   rel="bookmark"><?php the_title(); ?></a></li>
<?php endwhile; ?></ul>

You can increase or decrease the number of posts to be displayed as you like, and don’t forget to change the category id accordingly (both highlighted in red).

Related Posts

Themeum’s Flat Theme Multipurpose WordPress Theme

Planum Multipurpose WordPress Theme

Starter Responsive WordPress One-Page Theme

Weblizar Premium Responsive Theme