Showing recent post from a specific category
Posted
by kwek-kwek
on Stack Overflow
See other posts from Stack Overflow
or by kwek-kwek
Published on 2010-05-04T19:06:48Z
Indexed on
2010/05/04
19:08 UTC
Read the original article
Hit count: 446
I wanted to show post from just recent post from a specific categories
so far this is what I have but:
<ul>
<?php
$number_recents_post = 5;
$recent_posts = wp_get_recent_posts($number_recents_post);
foreach($recent_posts as $post){
echo '<li><a href="' . get_permalink($post["ID"]) . '" title="Look '.$post["post_title"].'" >' . $post["post_title"].'</a> </li> ';
} ?>
</ul>
I tried turning it into this but not working
<ul>
<?php
$number_recents_post = 5;
$recent_posts = wp_get_recent_posts($number_recents_post . 'cat=3,4,5');
foreach($recent_posts as $post){
echo '<li><a href="' . get_permalink($post["ID"]) . '" title="Look '.$post["post_title"].'" >' . $post["post_title"].'</a> </li> ';
} ?>
</ul>
Please let me know what am I doing wrong....
© Stack Overflow or respective owner