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

Hi I'm attempting to create my own custom template that will have a format like this:

<?php get_header(); ?>

    <div id="container">

      <div id="top-half">
      <!--fixed content here that is stored in the page template-->

           <div id="bottom-half">
   <!--Content pulled from the actualpage that has this template assigned to it-->
<?php get_footer(); ?>

Right now I'm using <?php the_content(); ?> and instead of pulling the page content, it's pulling a specific post from my post list. I'm not quite sure why this is happening.

UPDATE: The code below was located in a widget that was being processed just before the Wordpress loop took effect in my template. I didn't reset my query using wp_reset_query(); so Wordpress displayed only a single post.

    <?php query_posts('p=63'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile;?>
share|improve this question
can you try to clarify your question. I see in the comments below that you said wp_reset_query() fixed your problem, but that doesn't seem to answer the question you've asked. I think you either need to be more specific or expand your code snippet. Since this site tries to leave behind "canonical" answers that will help other people, it's important to help the community by asking well-worded, specific questions. – mrwweb Jun 21 '12 at 0:12
thanks mrwweb, I changed the question around a bit. Thanks for the input, I think this post should be a little more helpful now. – Rob Myrick Jun 21 '12 at 15:25

You pull content normally. You don't have to specify any id, as page/post will use template it is assigned to, so I don't really understand your question.

share|improve this answer
Thank you OriginalExe for your help. I had a sidebar display in the top half of my template and I needed to use wp_reset_query(); to display the content. I was going nuts! – Rob Myrick Jun 20 '12 at 23:28
What function are you using to get the content in your sidebar? If you are getting a list of posts or something similar, you should be using get_posts() and not query_posts(). – Joseph Leedy Jun 20 '12 at 23:53
Yes, I am using query_posts(). What is the reasoning behind your suggestion? – Rob Myrick Jun 21 '12 at 0:18
Read here about drawbacks of using query_posts() more than once. codex.wordpress.org/Function_Reference/query_posts#Caveats – OriginalEXE Jun 21 '12 at 15:53

Here is what worked for me:

   <?php query_posts('p=63'); ?>
   <?php while (have_posts()) : the_post(); ?>
   <?php the_content(); ?>
   <?php endwhile;?>

   <?php wp_reset_query(); ?>
share|improve this answer
Please don't use query_posts: it breaks things :) – Stephen Harris Jun 21 '12 at 16:02

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.