WordPress.org

Support

Support » Plugins and Hacks » Assign categories to Pages?

Assign categories to Pages?

  • As anyone who’s used a theme without a page.php will know, all Pages are automatically set to the default category. I would like a way of assigning a category to a Page (so I could, for example, put my ‘wordpress help’ page in the ‘wordpress’ category along with my wordpress templates). Is there a plugin or hack that would enable me to do this? I don’t mind messing with function files if I have to.

Viewing 15 replies - 1 through 15 (of 24 total)
  • Uh, why not just make “wordpress help” a category?

    Could you set up your “wordpress templates” as a Page template and assign that to your ‘wordpress help’ Page? Assuming these we are talking about a template specific to the ‘wordpress’ category.

    http://codex.wordpress.org/Pages#Page_Templates

    Uh, why not just make “wordpress help” a category?

    Because I cannot assign a Page to the category ‘wordpress help’ any more than I can put it into the category ‘wordpress’. Why do you think giving the category another name would change things?

    So the current possible solutions are:

    a) per Kaf’s suggestion, I make Page templates which include the template lists (which are technically category archives) along with the help text. I like this because it encourages people to read the help section.

    b) I make category templates including a manual link to the relevant Pages (could probably be done with a single category.php)

    c) Or I could delve into the database and see whether it’s possible to specify a category manually.

    Wow, am I really the first person ever who’s wanted to categorise their Pages?

    No, you are not the first, but the purpose of Pages in WordPress has gotten out of control in its usage. They were meant to be the pages like “About”, “Schedule”, “Copyright”, “Legal Policies”, not for whole sections or grouping with other information. People who are still thinking static HTML pages (like I did) have a hard time getting their head about the idea of post vs page.

    I started out putting a bunch of stuff in Pages and then realized that it just wasn’t working. I moved them into posts, gave them categories, and now I have a power over the ability to add and connect information in very exciting ways, expanding what I thought of as Pages into exciting project sets.

    Since Pages were added with 1.5, maybe they will have categories in future editions. I’m sure it’s on the list. But for now…..

    the purpose of Pages in WordPress has gotten out of control in its usage

    I’m not sure if that’s a logical comment – if that were true, no one would use WP for anything other than blogging. Instead people are testing and pushing the limits of WP into other directions, try to work around any limitations. You can’t call something a CMS and then say a feature is being used out of control.

    Categorising pages is a fair and valid request, and it also makes sense in terms of orgainsation.

    Or we can just go back to static forever scrolling HTML pages with neon counters, or how about no images? Because we wouldn’t want to go crazy with ideas now would we?

    If we do get cats for pages, is anyone that uses it going to be called a nutjob?

    I agree that we should be able to assign a category to a page. Either that or be able to hide the byline. Having a page that is labeled as “uncategorized” just doesn’t look right.

    I didn’t completely understand the initial request. The only thought I can offer is that you could hardcode your WordPress Help Page into your WP category template (if you’ve got a separate template for WP), otherwise you could use a conditional statement to get the link to appear — if ( is_category ( '#' ) ) { echo "<a>WordPress Help</a>" }.

    I would like to be able to assign categories to pages, or hide the the byline as mentioned above. The default category just doesn’t make sense on some pages.

    I don’t fully understand this either, but I’m getting more out of what Lorelle said. Is she basically suggesting, type your “page” information into a post and categorize the post, instead of making it a page?

    To those complaining about the default category appearing in Pages: it means you do not have a page.php template in your theme, so WP is using your index.php to display the content of the Pages. Just save your index.php as page .php and edit/delete whatever you find “nonsense” on a Page.

    Thanks. that works.. my problem was I was copying the page.php file from the default theme into my custom theme, and that didn’t work. (I got that idea from the codex at http://codex.wordpress.org/Pages#Creating_your_own_Page_Templates) Copying the index.php from my custom theme and renaming to page.php worked.

    “Since Pages were added with 1.5, maybe they will have categories in future editions. I’m sure it’s on the list. But for now…..”

    Ah, so what I’d like to do…. isn’t possible yet? I want to add a second set of pages to my sidebar under a different category than “Main”. My “Main” header has pages “About (me)”, “About (the site), “Contact (me)”, etc. I’d like to have another Category of “Resources” and have separate pages for “Books”, “Music”. I’m assuming by the discussion here that it’s not possible yet with WP 1.5?

    If posts were suitable for static, undated information which needs to be easily accessible from the sidebar, I’d have used posts. They’re not, which is why we have Pages.

    In the end, I decided to take the content of my Pages and turn them into php includes. This is the system I was using pre-1.5, and it fits my needs better than Pages since it gives me much more flexibility in how it’s presented. Page categories would still be handy, though; at the moment I’m having to enter all links to Pages manually because I want different types under different headings.

    (And I never said it should be in the core. This thread is under ‘Plugins and Hacks’ for a reason. 😉 )

    You can hack around and assign categories to pages – I’ve done it before; I ran into problems once I started using more functions and plugins that dealt with categories, though, so I guess I would consider if you have much of that going on. However, like some of the posts above suggests, I found it to be too problematic at times, and found a better solution incorporating tags and such. Anyway, I have no idea what I’m doing, but I would be happy to try and look at the files again and see if I can remember what I did.

    Hi,

    After reading the entire thread, I am not exactly sure if a “solution” was mentioned? Well, anyway, just to put in my two cents worth.

    The way I went about it today was to define a page as the “parent” page – this can be a blank entry. The title of this entry will act as the category heading. Next I created all pages relevant to the category to be under this parent. By manually coding the category headings and then using the following

    <?php wp_list_pages(‘sort_column=ID&child_of=12&title_li=’); ?>

    where 12 = ID of the parent entry, I can then get a “categorized” listing of relevant pages.

    Hope this helps your particular application!?

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Assign categories to Pages?’ is closed to new replies.
Skip to toolbar