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 created a theme, and I created a page for the theme, and now I want to associate posts to the page. I read this article:


Look under the section "Examples of Pages and Templates", there is this code:

<div id="content" class="widecolumn">
 <?php if (have_posts()) : while (have_posts()) : the_post();?>
 <div class="post">
 <h2 id="post-<?php the_ID(); ?>"><?php the_title();?></h2>
 <div class="entrytext">
  <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
 <?php endwhile; endif; ?>

It seems to be pulling some posts associated with a page. How can I create posts for a page? And if not possible, what are they doing or what kind of altenrative is available to me, other than hardcoding html into the page?

share|improve this question
A page is a post, with the 'post type' of 'page'. If you're referring to this code: <?php if (have_posts()) : while (have_posts()) : the_post();?> -- This is 'The Loop'. – Jared Jun 28 '12 at 18:37
@Jared my question though is I want posts on the page – JohnMerlino Jun 28 '12 at 20:57
up vote 0 down vote accepted

You can use wp_query with different arguments to list the posts that you want to appear on that specific page (i.e. all the post that are assigned to the X category or all the post that belong to Y author a.s.o). You can find on the Wordpress Codex a detailed presentation and examples on how to use wp_query.

share|improve this answer
Hey great, Ill check it out. I honestly, think its just easier when I come to think of it, just use the page box to add the content, but your suggestion Ill keep in mind. – JohnMerlino Jun 28 '12 at 21:42

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.