• “Pages are not … nor can they be associated with Categories.”

    Has anyone created a pluggin or hack to alter this? I really want to use WP to update my site but it will consist of both posts and quite a lot of articles (pages). As there are several distinct subjects covered by the articles on the site (pages) I want the users to be able to sort pages by category.

Viewing 10 replies - 1 through 10 (of 10 total)
  • What about using the parent-children relationship to “categorize” the (sub)Pages?

    Thread Starter obscure

    (@obscure)

    Not really sure how that works. Could expand on that or point me to the area of the docs it would be covered by? I tried searching for Parent child but couldn’t find anything in the docs.

    Briefly, every Page can be assigned to a “parent” (right top in the Write Page admin panel), so basically you can create a tree of sub- and sub-subPages.
    There is a short description of it: Pages#Organizing_Your_Pages

    Thread Starter obscure

    (@obscure)

    Thanks for that but can posts also be associated to the same parent?

    No, because posts are not Pages 🙂

    Here’s what you might be able to do. First create a theme template file for each category. Make sure that each category template’s file name is category-x.php, where x is the id number of that category. Create category-x.php with all the important template tags and your theme code. Right below the template tag (or wherever you want honestly) for the content in each template, put wp_list_pages with the child_of condition like so..

    <?php wp_list_pages(‘child_of=x’); ?> <–x is the id of the correct parent page.

    I’m guessing that wp_list_pages would need to be outside of the loop.

    Second create a page corresponding to each of the categories you have. These parent pages will be sort of surrogate categories for your pages.

    If you take all that work once, you’ll have the normal page that holds all the posts in one category with a list of pages in the same sort of category.

    Does that make any sense? I haven’t tried this but I’m pretty sure it’d work.

    Kri,

    That *kinda* works, but it sure would be a lot cooler if you didn’t have to hard-code x for ‘child_of=’ in each template … it might mean that you could have just one template, eh?

    I found the line below somewhere in this forum the trouble is, I don’t know how to get the variable $parent_id filled in. I’ve used the_ID() but it didn’t seem to work. Any suggestions?

    < ?php wp_list_pages('depth=2&sort_column=post_date&title_li=&child_of='. $parent_id); ?>

    Thread Starter obscure

    (@obscure)

    Thanks guys but I get the feeling your all thinking post OR pages, while I want posts AND pages sorted by category/subject. I don’t think that is going to happen so I will go in search of another solution for my site. Thanks for all the answers.

    How about: you can just make each of your “pages” a post within that category…. and then keep ahold of the permalink to that “post” which you can simply display as a hyperlink in your sidebar as if it was a page?

    This way, it falls in the category you want… and I don’t see how this would be any less functional than a normal WordPress Page, except it won’t automatically show up in your Pages menu. No big deal, you can make a link with a href=

    Thread Starter obscure

    (@obscure)

    Thanks Dgold. I will give that a try and see how it works.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Categories on pages.’ is closed to new replies.