• Maybe I’m just not searching for the right terms, but for the life of me, I cannot find an answer to this somewhat unique request.

    We have a section of our new site that will contain a portfolio. It will contain two types of content: 1) in-depth case studies, and 2) smaller client briefs. Case Studies are standard pages. Client briefs are a custom post type.

    This section has a landing page that loops through case study pages displaying links to them, and that loops through custom post types to display client briefs.

    We want all of this work to live under /work/. Right now, the custom post type is registered as ‘work’. This allows the client brief to have URLs: /work/client-name-1, /work/client-name-2, etc.

    We want the case studies to have URLs: /work/case-study-1, /work/case-study-2, etc.

    But right now, because we’ve devoted the set up ‘work’ for the custom post type, the pages that have parent page /work/ throw a 404 error.

    What’s the right strategy to get around this? How do we allow custom post types and pages to use the same parent/page hierarchy?

    The site is in private dev right now, so I’m unable to link to it. Hopefully the description above is detailed enough though.

Viewing 1 replies (of 1 total)
  • @studio1337

    So ‘work’ is a custom post type?
    Can you paste it’s register_post_type code here?

    And studies are each a page, right?

    Have you tried add_rewrite_rule. Something like this:

    add_rewrite_rule('^work/([^/]+)/?$', 'index.php?post_type=page&name=$matches[1]', 'top');

    So that way you rewrite any slug after /work/ to page.
    You can hook to init and execute this code.
    You may need to do flush_rewrite_rules before it will work.

Viewing 1 replies (of 1 total)
  • The topic ‘Can custom post type share parent with pages?’ is closed to new replies.