views:

10

answers:

1

I want my site to have a random "welcome" page.

I've found a plugin that redirects to a random page. I want to specify a parent page that random child pages are selected from.

This is the query that the plug-in uses:

$query = "SELECT ID FROM $wpdb->posts WHERE post_type = 'page' AND post_password = '' AND post_status = 'publish' ORDER BY RAND() LIMIT 1";

How would I get it to return a random child page from a specific parent page?

Thanks for looking.

A: 

So simple I missed it. Just add AND post_parent='42' where 42 is your parent's ID.

thv20