WordPress hack: Embed a page into another page

February 23, 2012 at 5:34 pm

Are you using different page templates on your WordPress theme? If yes, here is a cool hack that allow you to embed a page into another page.

Paste the code below within the loop. Make sure to update page ID on line 1!

<?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; ?>

Thanks to CSS Tricks for the tip!

Tags: