WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#4148 closed enhancement (wontfix)

Suggestion of a new category structure

Reported by: hovenko Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

I personally don't like the way wordpress presents categories, with URLs such as "http://example.tld/category/some-category", and especially not the possiblity to put a post inside several categories. That's a job for tags. Therefore I suggests a new category structure where we use a page as the parent (or category) of posts.

URL hierarchy

Pages gets a URL like "http://example.tld/my-page". By using a page as the category of our post we can have a URL like "http://example.tld/my-page/my-post" or "http://example.tld/my-page/2007/04/14/my-post for our posts. As a bonus the "category" page would work as SEO Siloing.

New page template

This would also bring up the need for a new page template similar to the archive template, where the latest posts inside the category/page can be displayed together with the content of the page. An example would be that the five last posts in that category/page could be listed beneath the page content. This would replace the category templates where the file name of the template files ends with the ID of the category, such as "category-14.php", which is much harder to maintain on a page with many categories.

Post templates

With this solution the posts will have only one category, the page it was assigned. That way it is possible to have post templates based on the nicename of the page. This will solve the problem that I have today when I need different layout of my posts based on which category it belongs to.

Default page for posts

The default category for posts will then (of course) be the front page, and a post on the front page will get a URL as "http://example.tld/my-post".

Database structure

Posts and pages uses the same database table ($wpdb->prefix . 'posts') and we then need a link between a post and a page to make this relation possible. My purpose would be to create a new table ($wpdb->prefix . 'post2page') to handle the relation between posts and pages where we will have two columns, one primary key that would be the "post_id" and the other would be the "page_id", both referring to the same posts table and the column "ID". This is because I want to leave the posts table as is and as well making it easier to extend this relation later on.

Category management

There would then be no need for the categories as we know it from todays WordPress. Tags, that will come with the WordPress 2.2 release, will be able to replace the functionality of adding a post to multiple categories.

Change History (6)

#1 @foolswisdom
10 years ago

  • Milestone changed from 2.3 to 2.4

#2 @rob1n
10 years ago

Replying to hovenko:

I personally don't like the way wordpress presents categories, with URLs such as "http://example.tld/category/some-category", and especially not the possiblity to put a post inside several categories. That's a job for tags. Therefore I suggests a new category structure where we use a page as the parent (or category) of posts.

Why? By all means, if you don't want to use more than one category on a post, then DON'T. But don't deny other people the right to do so. Remember, more people use WP than just you.

URL hierarchy

Pages gets a URL like "http://example.tld/my-page". By using a page as the category of our post we can have a URL like "http://example.tld/my-page/my-post" or "http://example.tld/my-page/2007/04/14/my-post for our posts. As a bonus the "category" page would work as SEO Siloing.

WHY? We have subpages for a REASON. For this exact use. If you really wanted to, you could do /category/postslug.html, which is a better use than making pages do this.

New page template

This would also bring up the need for a new page template similar to the archive template, where the latest posts inside the category/page can be displayed together with the content of the page. An example would be that the five last posts in that category/page could be listed beneath the page content. This would replace the category templates where the file name of the template files ends with the ID of the category, such as "category-14.php", which is much harder to maintain on a page with many categories.

I don't think you understand what categories and pages are, and how they're separate.

Post templates

With this solution the posts will have only one category, the page it was assigned. That way it is possible to have post templates based on the nicename of the page. This will solve the problem that I have today when I need different layout of my posts based on which category it belongs to.

So hook into the template loader. It's not that hard, and the hooks are there for a reason. And if you need a hook, tell us and we will most likely put it in.

Default page for posts

The default category for posts will then (of course) be the front page, and a post on the front page will get a URL as "http://example.tld/my-post".

You make no sense. As I said before, you probably want subpages.

Database structure

Posts and pages uses the same database table ($wpdb->prefix . 'posts') and we then need a link between a post and a page to make this relation possible. My purpose would be to create a new table ($wpdb->prefix . 'post2page') to handle the relation between posts and pages where we will have two columns, one primary key that would be the "post_id" and the other would be the "page_id", both referring to the same posts table and the column "ID". This is because I want to leave the posts table as is and as well making it easier to extend this relation later on.

Category management

There would then be no need for the categories as we know it from todays WordPress. Tags, that will come with the WordPress 2.2 release, will be able to replace the functionality of adding a post to multiple categories.

No. No. No. No. Over my dead body. Tags are NOT equal to categories (despite the rather shortsighted decision to put them in the same table). Never will they be. They both have their own semantic uses.

#3 @markjaquith
10 years ago

A shame that such a nicely formatted report was made for something that, I feel safe to say, isn't going to get any traction with the community. Makes it harder to shoot it down, because I know a lot of work went into preparing the report, but bad news has to be delivered by someone.

Categories offer hierarchy and multiplicity. Your solution splits those two concepts, forcing people to choose.

It sounds like you're looking for a solution to a specific issue you're having. The in_category() function might help you out, keeping you from having to write a zillion different template files. Just use logic within one template file to change the portions that need to change.

#4 @hovenko
10 years ago

I see that the current way that categories work is actually wanted as it is, but pages have what is needed to act as categories.

A category can have subcategories to make up a hierarchy, but pages can also be ordered like that. A page can be a subpage of another page.

It might be desirable to have pages that are not behaving as a category for posts. This functionality can be achieved by adding a checkbox to control this the same way comments and pings can be turned on and off on a page. Alternatively the author of the page can select a template that doesn’t display any posts related with the page.

There are users that want to place a post inside several categories. A solution to this will then be to allow for multiple posts-to-pages associations by using a combined primary key in the post2page table over both the "post_id" and "page_id" columns instead of my first proposal of "only one page per post".

I know it is a bit radical thinking and a big change to WordPress by doing this, but you might want to write posts that are related to your page. For example if you write a page with information about WordPress and your plugin development, then you probably want to publish your new plugins as posts, not as subpages of the WordPress page. The exception from this is pages such as "about", "legal" and so on, but with the ability to disable posting to those certain pages (see above) this makes it possible.

It was just a suggestion to improve WordPress. It is not a specific issue I'm having any longer, since I managed to give posts in different categories the diffent look I needed by placing both the logic and the view/html inside a plugin. A bad solution, I know, but it works. I didn't want too much logic in the theme files that are dependent on some plugin. The different looks I needed was not only when displaying the posts on the category page, but also when using the "single" template.

#5 @rob1n
10 years ago

So is it safe to close this as won'tfix?

#6 @foolswisdom
10 years ago

  • Milestone 2.4 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing WONTFIX, reviewed by Rob1n and markjaquith.

hovenko, this class of issue is likely best hashed out to some consensus on the mailing list -- but that you for the very easy to read report!

Note: See TracTickets for help on using tickets.