0

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:

http://codex.wordpress.org/Pages

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>'); ?>
 </div>
 </div>
 <?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?

2
  • 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
    Commented Jun 28, 2012 at 18:37
  • @Jared my question though is I want posts on the page Commented Jun 28, 2012 at 20:57

1 Answer 1

0

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.

1
  • 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. Commented Jun 28, 2012 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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