WordPress.org

Ready to get started?Download WordPress

Forums

passing additional GET variables to post (2 posts)

  1. lerizzle
    Member
    Posted 3 years ago #

    Hi,

    I posted a few questions about different approaches I'm taking here and have had no luck with replies... hopefully my new approach will be clearer.

    What I'm trying to do is when someone goes to my taxonomy archive for my custom post type I need to remember which taxonomy they came from because on my post I need a next and previous based on that taxonomy.

    I currently have a taxonomy
    mysite.com/galleries/[continent]/[country]/[city]/

    So this works also
    mysite.com/galleries/[continent]/[country]/
    mysite.com/galleries/[continent]/

    My original idea is that each photo is a custom post-type. So I wanted

    mysite.com/galleries/[continent]/photo/[post_name] or
    mysite.com/galleries/[continent]/[country]/photo/[post_name] or
    mysite.com/galleries/[continent]/[country]/[city]/photo/[post_name]

    this would have been perfect but from all my research it doesn't look like it would be. correct me if I'm wrong.

    NOW my new approach is to keep my taxonomy URL's as is but recreating my permalinks from that taxonomy. So if someone is browsing a city my permalinks would be

    mysite.com/continent/[continent-slug]/country/[country-slug]/city/[city-slug]/photo/[post_name] OR

    mysite.com/continent/[continent-slug]/country/[country-slug]/photo/[post_name] if they were in the country taxonomy OR

    mysite.com/continent/[continent-slug]/city/[city-slug]/photo/[post_name] if they were in a continent taxonomy.

    BTW it's all the same taxonomy I'm figuring it out by hierarchy.

    So I started with continent

    add_rewrite_rule( 'continent/([^/]+)/photo/([^/])+/',
    				'index.php?post_type=photo&continent=$matches[1]&post_name=$matches[2]', 'top');

    and I register this var $vars[] = 'continent'

    which allows this
    mysite.com/continent/north-america/photo/bryce-canyon-sunset-iii/

    but doesn't give me the right result

    What would be my next step to say

    "Serve this a custom post type photo BUT leave the URL as is"

    If I can get this done I know which taxonomy they came from and I can do my next and previous.

    Thanks

  2. lerizzle
    Member
    Posted 3 years ago #

    Please, I'm begging :) any direction to solve my complete project block would be more than appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic