April 9 2010
Wordpress Tip: Recent, Relevant, and Random Blog Posts
12 May 2010 Update: Interestingly, Google Analytics revealed that in the month since adding the sidebar, there’s been no significant change in the average time spent on the site (54s) or pages per visit (1.3). I still like it.
Recently, I thought it would be interesting to add a sidebar to my Wordpress blog. I figured a short list of recent posts, relevant posts, and random posts would help surface information people might find useful. Here’s a quick rundown of how to add these with the PHP code below:
- Recent Posts: one-liner with simple WP PHP call
- Random Posts: a couple lines because I wanted random posts but sorted descending by date (not simply get_posts('numberposts=5&orderby=rand&order=desc');)
- Relevant Posts: also called related posts, a template-based plugin worked best for me: Yet Another Related Posts Plugin (YARPP) </ul>