View Full Version : random blog articles

10-01-2008, 04:41 AM
hey, I would like to have a column on my sidebar on the homepage to show like 5-10 random blog posts, how can I do this?

10-01-2008, 01:42 PM
Is this WordPress?

10-01-2008, 07:26 PM
yes it is wordpress

10-02-2008, 12:45 AM
If it shows the random blog posts, won't some of them
be really big (lots of text) and some be small ... and
some of them have images?

Are you talking about displaying random post literally,
or just a list of random links to your posts?

There's not much room in the sidebar for complete posts?

To find out how many posts there are, you use this PHP coding ...

$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts);

Each post is displayed by a number, example:

So, if you were to pick a random number between 1 and $numposts,
you would be displaying a valid post. If you wanted 5 random posts,
the trick would be to pick 5 of them, without repeating any.


10-03-2008, 04:05 AM
my website is www.paranormalknowledge.com

I want on the sidebar below popular articles to have the same thing but produce 5 random articles with the names displayed like popular articles. How do I do that? What you just showed me?

10-03-2008, 02:43 PM
?? It looks to me like it already has 5 random articles ??

I'm confused.

10-06-2008, 04:56 PM
What does that question mean?

Are you asking about how to install WordPress and use it on your website?

10-06-2008, 05:33 PM
No! He's likely to be spamming the links in his signature.

Um.. it's not his signature! Oh.. he's banned now :)