[Support request] Duplicate Sub-Categories

Home Forums Support [Support request] Duplicate Sub-Categories

Home Forums Support Duplicate Sub-Categories

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #613509
    Andy

    Hi,
    Although this isn’t strictly related to GP I was hoping it would be ok to ask the question here as I will be using GP for the build. Basically I’m wondering what the best way is to categorize a site that needs to use the same sub-categories across different parent categories.

    So for example if you had a Movie review website with the category/sub-category hierarchy as below:

    DVDs
    – Action
    – Scifi
    – Horror

    Cinema
    – Action
    – Scifi
    – Horror

    Wordpress doesn’t allow you to do this because you can’t have 2 sub-categories with the same slug/URL. I know I could just rename the category slugs slightly but I think that can look rather messy and ugly. I know there are plugins that will ‘hack’ the permalink system to allow duplicate category URLs but I was hoping there would be a better way.

    One solution I thought of was to make each sub-category a parent category and then only show posts that from BOTH categories. I’ve used the excellent WP Show Posts plugin in the past to display posts from certain categories but I’m not sure if the plugin shows posts from EITHER categories or BOTH. So I would have to create some custom category archives and use some kind of if statement from the WordPress Codex to achieve this.

    But would this solution work and scale well as the site grows, how do you approach this problem and is there a better way?.

    #613771
    David
    Staff
    Customer Support

    CPT / Custom Taxonomies would be the better option. Although its still a work around. Maybe check out PODs and their Relationship fields, perfect for this sort of thing.

    #613799
    Andy

    Hi David,

    Thanks for the informative reply. So will WordPress allow duplicate sub-categories across different CPTs even if their URLs are the same?.
    Do you think my solution mentioned previously is a viable option? I’ll have a look into PODs too but I’d prefer to avoid going down the plugin route, incase 12months-2years down line and after 100’s of posts they stop supporting and developing the plugin.

    #613802
    David
    Staff
    Customer Support

    I am no expert on this but i think the CPT work around would be to create Post types instead of Parent Categories. Then the sub category problem goes away. Its just a case of adding them all to the loop.

    #613803
    Andy

    I’ve created CPTs before so I have a bit of experience with them, but if I created a CPT called ‘DVDs’ and then another CPT called ‘Cinema’ I would then need ‘Action’, ‘Scifi’ categories in both CPTs.

    Maybe Tom could comment on this?

    #613804
    David
    Staff
    Customer Support

    Taxonomies are not tied to a post type so can be shared. I will pass this onto Tom to get his two cents worth.

    #613879
    Tom
    Lead Developer
    Lead Developer

    As long as they belonged to different taxonomies, you should be able to use the same names.

    Of course, it depends on how you structure the URL of the taxonomies.

    #614182
    Andy

    ok so just to clarify the URL’s of the taxonomies can also be the same?

    #614535
    Tom
    Lead Developer
    Lead Developer

    Not exactly the same, no. That would confuse WP.

    The taxonomies would have to be different in order to make the URL different.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.