WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanna pull the data from this area "see the red area on the image below"

enter image description here

Out to a specific template

I have a page template named page.php

<div class="contentholder">
        <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part( 'content', 'page' ); ?>
            <?php comments_template( '', false ); ?>
        <?php endwhile; // end of the loop. ?>
        <br />

but this just send me a comment field.. i need the text in the page

and i need the header

share|improve this question
There is a call to get_template_part, can you post the relevant code for content.php or content-page.php? codex.wordpress.org/Function_Reference/get_template_part – Tom J Nowell Jan 17 '13 at 10:17
up vote 1 down vote accepted

While inside a query loop, this function will output the current posts title:


This function will output the content:


What I suspect has happened however is that you are instead calling get_template_part( 'content', 'page' ); and expecting it to output the content for the page, when what it's actually doing is checking if there's a content-page.php, and including it if it's present, if not it checks for content.php and includes that, and because neither exist, it's doing nothing, and so you get no content.

For more details on what get_template_part actually does, look here:


Working snippet:

<?php while ( have_posts() ) : the_post(); ?>
     <?php the_title(); ?>
     <?php the_content(); ?>
<?php endwhile; // end of the loop. ?>
share|improve this answer
Can you post the surrounding code im pretty new at wordpress so if you could make a snippet that i could just take to post it, it would be nice – Simon Pertersen Jan 17 '13 at 11:05
You mean a copy paste? I'm sorry but that's not what you asked for. The 2 calls above are already in a highly copy pastable form, put the bit that displays the title in the part where you want it to display the title, and put the bit that displays the content in the bit where you display the content. I shan't demean myself with copypasta – Tom J Nowell Jan 17 '13 at 11:12
nvm i got it now – Simon Pertersen Jan 17 '13 at 11:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.