
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.

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!
4 Responses
Usefull,
.
But do not forget to call the function
wp_reset_postdata();after the endwhile so the main query will not be overriddenRahe
I’ve used an alternative solution in the past with success:
http://stackoverflow.com/questions/4090698/wordpress-include-content-of-one-page-in-another
Just throwing it out there as another option.
This trick is seems to be easy but can you tell me what is the advantage of embedding one WordPress page to another? I have done it with my one WordPress page.
And when I put the wp_reset_postdata(); it gives error at line 40 .
Hi @Tushar try wp_reset_db() or $wpdb->flush().
hope that helps.
Trackbacks: