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….
According to the Codex, you can’t use
wp_get_recent_posts()
the way you do:Maybe codedude’s example helps.
why don’t you try this (assuming you are using WordPress)