• I need to find a way of making one custom post type a child of another and for the permalink structure to reflect that.

    I’m getting in a complete twist over this and really hope someone can help. I think I possibly might have got my thinking back to front.

    My site consists of a main ‘umbrella’ company site (with pages, news / blog etc – using worpdress’ default posts and pages), which then also lets a user visit sets of specific branch / or sub company pages accessible from the main nav.

    (Throughout I refer to Custom post type as CPT and custom taxonomy as TAX).

    I’ve created CPTs and Taxonomies as below:
    CPT = Branch
    CPT = Case studies
    CPT = Products
    CPT = Recent news
    TAX = Location

    When someone visits a Branch page they see an overview of the Branch (setup with various custom fields within the CPT)
    >> URL structure: site-url/branch/london-branch

    The user can click on a Case studies link to see Case studies (CPT) for that branch
    >> URL structure: site-url/branch/london-branch/case-studies

    Same goes for Products and Recent news CPTS:
    >> URL structure: site-url/branch/london-branch/products
    >> URL structure: site-url/branch/london-branch/recent-news

    However, the recent-news page would probably show the last 10 recent news items, which I then want a user to be able to click through to read the single news post:
    >> URL structure: site-url/branch/london-branch/recent-news/single-news-post

    Does that make sense?

    I’ve created a simple Sitemap/tree diagram to hopefully illustrate things a little better.

    I’ve used the Location taxonomy as a way to link all the different CPTs together by branch location.

    I’ve tried all sorts of options within my templates but can’t find anyway of achieving what I need.

    I’ve tried the post2posts plugin, which is great and allows me to link between CPTs, but I don’t get the permalink structure I’m after, so that currently isn’t working for me.

    My next thought was to use a multisite install using a master site for the main company umbrella site, with a mini-site used for each branch. Would this be a better of doing this as I think it would solve my url/permalink issues.
    I think this is achievable, but is there anyway to share a custom post type (i.e CPT: Products) between each of the different sites in a multisite install as each Branch would have the same products available.?

    Many many many thanks if you’re able to help – I’m really stuck!

    Cheers
    Stef

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter tictok

    (@tictok)

    Another option to get a logical URL structure, but I don’ know how to do it, would be to somehow ‘cheat’ the permalink to look like CPT’s are children of each other. Is this possible?

    Thanks

    I’m not sure of a way to do it using custom post types alone. But a mix of pages and posts could be as follow:

    A main page for branches that is /branches/
    Subpages for each branch /branches/london/

    Custom post type “Case Studies” would need hierarchical set to true. You’ll also need to set supports to include “page-attributes”.

    Then each time you add a case study you’ll be able to attach it to a branch page.

    Just a thought, I’m no pro at this. Just learning myself.

    Thread Starter tictok

    (@tictok)

    Hiya Raymond –

    Thanks for replying.
    I tried your suggestion but unfortunately it doesn’t work for me.

    When you say

    Then each time you add a case study you’ll be able to attach it to a branch page

    do you mean make the case study custom post type a child of the branch page?

    I might be wrong but wordpress doesn’t let you make different post-types parents or childs of each other…

    However, I’ve got an idea to try in the morning, it’s a bit of a cheat but will let you know if it works.

    Thanks
    Stef

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Post Type (CPT) as child or subpage of another CPT? or Multisite??’ is closed to new replies.