• Resolved MNS

    (@mns)


    Hey guys,

    I would like to know how I should handle stuff that I handled in a “normal” PHP Application with GET Variables. To be more specific, I need to know the following case.

    I’ve created a “Custom Post Type” with a “Custom Taxonomy” for category. Now I would like to get all Articles of a certain category. To create the SQL query is no problem at all. My only problem is delivering the info to the certain template file which term of which taxonomy is to grab. (Which I usually would achieve by using simple GET Variables)

    Example:

    http://www.example.com/template.php?taxonomy=projectcategory&term=music

    How can I achive this inside the permalink structure? I wouldn’t even need a in depth explanation but maybe a reference to a good article/tutorial that describes that.

    Thanks in advance,
    Marvin

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter MNS

    (@mns)

    OK, I did some research and I came to some results. I use the get_term_link function to create the link I need. It works actually prefect as long as don’t use permalinks. It creates the following link without permalinks:

    http://www.example.com/?projectcategory=music

    It directs to the template file taxonomy.php and I can read the value projectcategory (in this case it’s music) with get_query_var. That’s all I want as I can now filter all posts for this term.

    BUT, when I now switch back to one of the permalink structures the link transforms into the following:

    http://www.example.com/projectkategory/music/

    Looks nice but unfortunately now the link doesn’t direct to my taxonomy.php template file BUT to my index.php. Can someone explain this to me?

    Thanks,
    Marvin

    Thread Starter MNS

    (@mns)

    Ehm, OK. After about 5 minutes now, it suddenly worked. Guess it has been a caching problem. Still weird.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘GET Variables in WordPress’ is closed to new replies.