I need to append the content of one page into this one. I have tried to use a plugin which is very easy to use but doesn't work in my case. Then I found following code:

<?php $recent = new WP_Query("page_id=**ID**"); while($recent->have_posts()) : $recent->the_post();?>
   <h3><?php the_title(); ?></h3>
   <?php the_content(); ?>

but it adds only the title of the page, not the content. PHP is beyond my skills but I believe it's just a matter of adding a line of code inside the first page. Any suggestion?

1 Answer 1


You can use get_post_field() for getting the post fields i.e. Title, Content etc.

// Replace $post_id with the ID of your post/page
  get_post_field( post_title, $post_id);  
  get_post_field( post_content, $post_id); 
  • is there a way to upload files in this forum?
    – user72891
    May 15, 2015 at 8:51
  • What do you want to upload, Criss? If it's code, use Pastebin service or edit the question.
    – m4n0
    May 15, 2015 at 8:55
  • because they are templates and not posts, I cannot use any method described to append the page, i.e. this page mediafire.com/view/lodc1dxafzxfbq4/page-contact-us.php into this page mediafire.com/view/3b4zu9fu6mavc2l/page-about-us.php
    – user72891
    May 15, 2015 at 9:05
  • Try this <?php get_template_part( 'page', 'contact-us' ); ?>
    – m4n0
    May 15, 2015 at 9:09
  • I guess what I'm doing wrong is the place where to insert the new code... this is the end of the main page template: </div> <!-- end member-details --> </div> <!-- end grid-layout --> <?php endforeach; ?> <?php endif; ?> </div> <!-- end .row --> </div> <!-- end .about-us --> <?php endwhile; endif; ?> </div> <!-- end .page-content --> </div> <!-- end .contenitore --> </div> <!-- end .container --> </div> <!-- end #page-content --> <?php wp_reset_postdata(); ?> <?php get_footer(); ?>
    – user72891
    May 15, 2015 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy