Recent posts:
<h2>Recent Posts</h2>
<ul>
<?php get_archives('postbypost', '5', 'custom', '<li>', '</li>'); ?>
</ul>
Change the number 5 to whatever you want.
Categories:
<h2>Categories</h2>
<ul>
<?php wp_list_cats('sort_column=name&optioncount=1'); ?>
</ul>
Try looking around a bit for the information and you might find it quicker next time. Did you do any kind of search for this information first? It’s been covered lots of times. Also, this function is built into several templates and the code needed to make this happen is readily available. Take a look here for listing the recent posts and categories:
http://codex.wordpress.org/Template_Tags/get_archives
http://codex.wordpress.org/Template_Tags/wp_list_cats
Thanks…I actually did look around but couldn’t find exactly what I needed. Sorry for redundance but I appreciate your help (& the other references).
Can you mark this “Resolved” so others know? Thanks. Glad those are resources that you can use.
When I am trying to copy the codes within my own blog, where does the code begin and where does it end? Everytime I try to copy it, I get an error on my blog.
I must not be copying the whole code or something. So is there a symbol it starts and ends with?
I know tsguitar added some code there for ya already, for the last 10 posts..but, just going to share with ya, this one..right from the Papillon theme:
http://www.vindictivebastard.net/downloads/last-10-posts.txt
spencerp
Make sure you aren’t pasting the code I gave you in between any PHP tags or you’ll get an error. For instance, try pasting that code at the very beginning of your sidebar, right after the initial DIVs, before anything else.
You copy from the <h2> to the </ul>. There’s nothing missing. If there’s an error on your site, then you have other problems with your templates or you’re pasting it in the wrong spot. If you glance at the default WordPress template (which you have installed on your blog, even if you aren’t using it), you’ll see that code there, too.
Both the code I sent and the code spencerp suggests are clean and should work just fine.