Thread Starter
hzp
(@hzp)
to be fair, I found both of those solutions by searching (i do always check. i hate playing the noob), but I wasn’t sure either of these really solved the issue.
I mean, i guess I understand that I could simply do a category list and exclude all other categories, but then, how do I get it to just list the post titles… postbypost? I didn’t see them working together anywhere in the codex. and don’t forget, this isn’t a page, but the sidebar.
For instance, with the coffee2code, when i looked, although it mentions in the top that it can limit by category, i don’t see it in the code itself. am i just missing it?
If you were to use the plugin, for instance, how would you write it to limit it to say, category 5, listing the 10 most recent post titles, by date?
Thanks for your patience 🙂
Well, based on the details provided at the link I pointed to, I imagine this would do it:
<?php c2c_get_recent_posts(10, '<li><a href="%post_url%">%post_title%</a></li>', '5'); ?>
Ordering by date etc. are the defaults, so no need to play with them.
By the way, using get_posts() for this is not too difficult, either:
<?php
$postlist = get_posts('category=5&numberposts=10');
foreach ($postlist as $post) :
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
Thread Starter
hzp
(@hzp)
🙂 thank you. that really helps a lot.
i’m going to give both a try tomorrow.
does the above code work with multiple category exclusions ?