WordPress.org

Ready to get started?Download WordPress

Forums

Categories on pages. (11 posts)

  1. obscure
    Member
    Posted 8 years ago #

    "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.

  2. moshu
    Member
    Posted 8 years ago #

    What about using the parent-children relationship to "categorize" the (sub)Pages?

  3. obscure
    Member
    Posted 8 years ago #

    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.

  4. moshu
    Member
    Posted 8 years ago #

    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

  5. obscure
    Member
    Posted 8 years ago #

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

  6. moshu
    Member
    Posted 8 years ago #

    No, because posts are not Pages :)

  7. kri
    Member
    Posted 8 years ago #

    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.

  8. earlax
    Member
    Posted 8 years ago #

    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); ?>

  9. obscure
    Member
    Posted 8 years ago #

    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.

  10. Dgold
    Member
    Posted 8 years ago #

    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=

  11. obscure
    Member
    Posted 8 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.