WordPress.org

Ready to get started?Download WordPress

Forums

Random Child Page (3 posts)

  1. jamesdfulton
    Member
    Posted 2 years ago #

    I'm trying to display a random child page's content. Not sure how to go about it. So far I'm using the following code to display 2 child page's content but I want these 2 to be random not the latest 2.

    <?php
    					$mypages = get_pages( array( 'child_of' => 48	, 'sort_column' => 'post_date', 'sort_order' => 'desc', ) );
    					foreach( $mypages as $page ) {
    						$content = $page->post_content;
    						$content = apply_filters( 'the_content', $content );
    						$count++;
    					    if ( $count < 3 ) {  // only process 3 ?>
    							<?php echo $content; ?>
    					<?php
    					}
    				}
    				?>

    thanks

  2. jamesdfulton
    Member
    Posted 2 years ago #

    Any help would be great!

  3. jamesdfulton
    Member
    Posted 2 years ago #

    Can anyone point me in the right direction?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.