The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End inserting a page inside a page Re: inserting a page inside a page


Hi Kloy ,

<?php $recent = new WP_Query("page_id=**ID**"); while($recent->have_posts()) : $recent->the_post();?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
<?php endwhile; ?>
this code will insert just one page:("page_id=**ID**")….

If you want to insert pages that are child pages of the current page then this code should work:

$pages = get_pages(‘child_of=’.$post->ID.’&sort_column=post_title’);
$count = 0;
foreach($pages as $page)
{ ?>
<h4><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h4>

hope it help!