WordPress.org

Forums

Custom posts and taxonomies url/permalink problems (1 post)

  1. Giu Tae Kim
    Member
    Posted 1 year ago #

    Hi. I'm developing a web site for a company that sell tour packs all around the globe.

    I was reading that the best way to achieve it is by using CPT and taxonomies... So I create a custom post type called "pack" (tour packs), and later custom taxonomy: "class" (for pack categorization).

    The cpt works great: The archive page: "mysite.com/pack" list all packs like a charm.

    BUT, there are things that doesn't seem clear to me. And I don't know if I'm missing something, or this is the natural wp behaviour.

    1 PROBLEM:
    Url structure doesn't make sense:

    For example, I write a tour pack for Rio de Janeiro in packs:

    Ex: "Rio de Janeiro 2013" (PACK) -> "International" (CLASS)
    URL: "mysite.com/pack/rio-de-janeiro-2013"

    As you can see WP show the pack url without taxonomy:

    This should be:

    Ex: "Rio de Janeiro 2013" (PACK) -> "International" (CLASS)
    URL: "mysite.com/pack/internactional/rio-de-janeiro-2013"

    BTW, I can't even create a proper page for taxonomy: "mysite.com/pack/internactional". I only can achieve it by parsing a custom query like this: "mysite.com/pack?class=internactional". But that kind of url are not seo friendly...

    Also, have this structure allow to build human-friendly breadcrumbs for site navigation ("Home >> Packs >> International >> Rio de Janeiro 2013")

    2 PROBLEM:
    Pagination not working:

    Simple: In the CPT archive page the pagination works ok:

    "mysite.com/pack/page/2/"

    But what happen when I list taxonomies? The only way I can is like this: "mysite.com/pack?class=international" in order to list international packs. But navigations in this kind of pages with "?" queries doesn't work. No 404 pages, only showing the same posts...

    "mysite.com/pack?class=international"
    - click "previous posts" -
    "mysite.com/pack/page/2?class=international" (o.o?)
    at least this should be:
    "mysite.com/pack?class=international&page=2" (is redirected to the above url)

    This of course, doesn't work in any way...

    POSIBLE SOLUTIONS:

    I was reading a lot about this... but the docs are not rly clear to me, I'm kinda newbe in cpt stuff. I read something about url rewrite functions but seems complicated to me.

    I'm also using custom fields to filtering results, and this mix make it more complicated...

    I rly appreciate your opinion, maybe this post help other developers...

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic