WordPress.org

Ready to get started?Download WordPress

Forums

How can I show custom post type through two URLs (3 posts)

  1. pksmith
    Member
    Posted 1 year ago #

    Can anyone help me out with the following problem I’m having with a portfolio site I’m developing to display projects by either client or medium.

    I have a registered custom post type “projects” and the two taxonomies, “clients” and “mediums“

    The site has already been designed (by someone else) and requires two different paths to view the projects by either client or medium. This state has to be reflected in both the main navigation state and the page navigation (previous and next links).

    Currently, I’ve managed to get this to work for the following paths:

    **/clients**

    **/mediums**

    and

    **/clients/clientA**

    **/mediums/mediumB**

    With each showing the filtered collection of custom posts and attaching classes correctly to the navigation so that the path or state is consistent with the URL.

    However, the permalink for the single post is currently set to the default for the custom post type of **/projects/projectX** which means that I have no way to determine within the single-projects.php the navigation state or previous/next links.

    ------
    How can I have both of these URLs show the same page and have have navigational elements on the page reflect the two different URLs?

    **/clients/clientA/projectX**

    **/mediums/mediumB/projectX**

    I’ve been going around in circles trying many different methods for a few days, so would really appreciate any help.

    Thanks in advance.

  2. michael.mariart
    Member
    Posted 1 year ago #

    The short story is, you can't. There are reasons for this though. The main one is that WordPress stores one URL per item and doesn't currently have a way to store two or more per item. Another one is SEO. If you have the same content served from two different URL's on the same site, you'll very likely be penalised for duplicate content.

    If you want to know where people have come from for the breadcrumbs, the only options that I can think of are to use multiple trails (I've seen this on eBay when a listing is in multiple categories), or you can use cookies or sessions to track where people are coming from and display the according trail. It's a bit complicated, but there's really not many other options.

  3. pksmith
    Member
    Posted 1 year ago #

    Thanks Michael, I was hoping that wouldn't be the case. I understand why from an SEO perspective one URL per page is good, and i think it's ok if that project is accessible at /projects/projectX.

    However I was hoping was that the custom post type could be reached through taxonomies which could then be used to show the state in the navigational elements to reflect the drill down from either "clients" or "mediums" which it does right up to the last page displaying the custom post type.

Topic Closed

This topic has been closed to new replies.

About this Topic