I am attempting to get 3 pages from the parent page (id is 2035). I am using wordpress 3.2.1.
Here's my relevant code:
<div id="videos" class="contentLeft"> <?php // get the three most recent videos (2035 is the video page) $recentVideos = get_pages('child_of=2035&number=3'); foreach ($recentVideos as $video) : ?> <div class="video"> <h5 class="video-title"><?php echo $video->post_title; ?></h5> <?php echo get_the_post_thumbnail($video->ID, 'thumbnail'); ?> <p><?php echo $video->post_excerpt; ?></p> <span class="date">Posted <?php echo date('d/m/Y', strtotime($video->post_date));?> — <a href="<?php echo get_page_link($video->ID); ?> ">View Video</a></span> </div> <?php endforeach; ?>
If I use:
$recentVideos = get_pages('child_of=2035'); I get results as I would expect; but I want to limit it to 3 videos. I've looked in the docs and it says to use
When I use this; I simply get a blank content area. The rest of the page renders fine, except where the videos should be. There is no output at all; or errors; as far as I can tell.
Am I missing anything glaringly obvious?
I've also tried passing
get_pages an array:
$recentVideos = get_pages(array('child_of'=>2035, 'number'=>3));
but the same thing happens.