Support » Fixing WordPress » Having a Page show ‘posts’ from one category

  • Resolved JPCSTL


    I have the start of a ‘writing’ page. As a child to that page I want two (for now) pages, one for my haiku and one for writing exercises. I would like to have this content added to the pages using categories, such that I could have a ‘post’ for category haiku (cat=11) and have it show up at the top of the Haiku Page. Likewise an exercise ‘post’ (say, cat = 14, it doesn’t currently exist) show up on the Exercise Page. Any suggestions?

Viewing 15 replies - 1 through 15 (of 15 total)
  • You will have to create new template pages for each category and customize the loop in each template to only show the selected category. This article in the codex can get you started. Once you have the templates, you can create pages (or child pages) using those templates. The sidebar section “Page Template” in the pages section of your site’s admin will have a list of templates to choose from.

    Don’t know what happened there. Fixed the link. But HandySolo’s might do better.

    Not sure what ryan’s link was – at a guess:

    Yes, HandySolo’s is much more on point.

    Thanks for the replies. I think I stumbled onto a/the solution. It works, but wouldn’t mind a critique and an easier/different way if there is one.

    I created a haiku.php file.
    In that I used query_posts cat=11.
    After that I put the rest of the code from the page.php template that came with my theme.
    Voila, it seems to be what I’m looking for (page here if you’re interested)

    Now, given this page, is there any way to get some html text, some intro text to the page, to set up the page before the posts start?

    And some additional comment to the suggestion of the category_template link. Even though I can click the category Haiku and get just that, I want it to be a particular Page, under the Writing Page. It seems to me that the categor_template is for modifying the look when someone views posts from the category archive view. That’s the look I’m going for, more or less, but I wanted it as a Page, and to show up under the Page list.

    Then I think my advice about altering the loop would be the answer.

    I’m with ryan (at least at the conceptual level): you really want to NOT use WP ‘Pages’ to implement this. Your easiest solution is to use categories themselves (writing as parent, haiku and exercises as children) for organization, then as needed make custom category templates where you want control over the category ‘views’ of posts.


    David & Ryan, why is this? Right now I’ve created a page template for Haiku that uses query_posts (cat=11) and it seems to do the trick. Am I heading for other issues if I keep creating pages this way? Not arguing here, just trying for some clarification, as I’m rather new and just piecing things together as I understand them.

    Second, if I do this using the category templates, then I’m NOT using Pages, right? So then the list_pages in the sidebar won’t navigate to these pages, right? So other than having people click on the category list, I want it to be a main part of the navigation. Does that mean I do it manually (as many themes seem to do anyway)? Using category templates won’t allow for auto generation of the Page lists, right? This isn’t a big deal, I just want the pages to be part of the main nav, not just accessible from clicking on the categories in the sidebar.


    I’m with ryan (at least at the conceptual level): you really want to NOT use WP ‘Pages’ to implement this. Your easiest solution is to use categories themselves (writing as parent, haiku and exercises as children) for organization, then as needed make custom category templates where you want control over the category ‘views’ of posts.

    Okay, question. I am using categories for organization. Haiku is cat=11, exercises will be cat=14, etc. I have now created a Page Template that queries cat=11, then formats the page. I have ALSO created a Category Template for cat=11 and formatted the page. I get the same results.

    The difference I see is that using the Page Template method, I’ll get the page (in this case a child page) listed in the wp_list_pages. Using the Category Template method, they won’t show up there, and will instead need to be manually placed in some nav list (across the top or along the side) manually.

    So, my question, are there Pros/Cons to one way over another? Seems the Page Template will work just fine, but a few above have said don’t go there.

    What’s the difference having the categories listed in a navbar or the Pages listed in a navbar?

    I guess the fact that using the Pages I’m able to auto generate the list using wp_list_pages in my sidebar. If I’m using Categories, then it won’t auto generate? I don’t know that it’s a big deal, really, but it is nice for the Pages to get listed in the sidebar automatically by including the wp_list_pages rather than having to go in and place it there. Like, use the tag once and it’s done, versus having to go in each time I create a page. Now, admittedly, I won’t have a slew of pages, but I can see where it might be .. cumbersome?

    As for links across the top, that’ll have to always be coded anyway (as far as I know) so I’m not so much worried about that.
    At least 3 of them generates the listing of categories…

    Huh. Obviously, and I’ve even played with some of those tags before in trying to figure out some theme designs and such. I don’t know why that never occured to me.

    Okay, so, I can use list_cats and get my auto generated list, using child_of to list only my writing pages (for example). That means I can use Page Templates or Category Templates and still get a list. Having used both to get the same looking page, are there any other reasons I should avoid Pages for this solution? Otherwise, it’s really not going to matter (so far as I can tell, now).

    Well, for now, until the Pages Management area is addressed, I would stick to sorting the category articles as mentioned in the beginning of the post.

    I tried using pages, but once you hit 100+ pages the Pages Management area of the Admin panel crawls to a halt the way it is currently coded.

    Ahhhhh, didn’t know that, didn’t know there was a Pages Management issue. Hmm. Well, seeing as I have a way to list cats as pages, and that it’s just as easy to make a Cat Template as it is one for Pages, I’ll stick with Categories. Lord knows folks here have their finger on the pulse of WP much more than I do, I was just trying to understand the differences and the issues. Thanks, all!

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Having a Page show ‘posts’ from one category’ is closed to new replies.