• Well, I got my site running, but I have a problem. I’m trying to make it so that each page only displays one category of posts. Here’s the site: http://www.tftblog.org. This is the code I’m using.

    <?php
    query_posts('category name=terrain');
    while (have_posts()) : the_post();
    the_content();
    endwhile;
    ?>

    So I’m working on the terrain page, and I’m trying to get only the terrain posts to pop up. What you see is that they do, but they also get lumped into one big post at the top! I’m new to WordPress, so I don’t know much about the code. I’ve searched around, and that’s what I could find. I did put in a plugin to allow me to use php code in the pages, which is where I put that string of code. Right in the Terrain page is where I put it.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • This needs to be done via the template – not within the post content. A couple of options:

    http://codex.wordpress.org/Pages#A_Page_of_Posts
    http://codex.wordpress.org/Category_Templates
    http://codex.wordpress.org/Template_Tags/query_posts

    Or maybe it’s that your code above has no HTML elements to seperate the content apart…

    So essentially what happens is it ends up on one continous line until an element or tag is reached in the content (paragraph tags for example are output by the_content function).

    To illustrate what i mean, does changing this line..

    the_content();

    to.

    the_content().'<br />';

    ..seperate the content a bit more?

    Thread Starter eternaldream

    (@eternaldream)

    Okay, I tried the first link esmi posted. There was a big lump of code in the middle, that would be a new php file called pageofposts.php. So I did that first. Next I looked at the category and page numbers. When I highlight over the link, in the address bar at the bottom, it shows a number. So I put those two numbers where it said page and category respectively. Now it doesn’t show anything. I made sure to erase the code I had on the terrain page too, and just let this template work.

    I’m not familiar with all this code, so I don’t know which I can cut out or not.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Query posts, they all get lumped in one post?’ is closed to new replies.