Hi!
I'm struggling to make a loop where, let's say 4, children of a certain page ID is shown at a footer.
I can make the loop with posts, but cannot figure out how to archive this functionality with pages...
The code working for posts, looks like this;
<?php
$querystr = "SELECT * FROM (SELECT wposts.* FROM $wpdb->posts wposts WHERE wposts.post_status = 'publish' ORDER BY rand()) as y limit 4 ";
$pageposts = $wpdb->get_results($querystr, OBJECT);
?>
<?php if ($pageposts): ?>
<?php foreach ($pageposts as $post): ?>
<?php //setup_postdata($post); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
<?php endif; ?>
Any help or guidance will be appreciated!
Thanks!