0

I have many pages which have a lot in common. They are supposed to display the same things but according to their own categories. The logical way to implement this would be to pass a variable through the url and display the info according to it.

The only problem is that my wordpress urls are rewritten...

I search this site before asking and I know there are posts around here related to that matter but they don't help me as they refer to some obscure regex I just can't associate to my own case. Not to mention some unexplained references to "tags" and "rules" which are quite beyond me. I reallly tried to learn from theses posts but I couldn't make use of them.

Basically, my urls are rewritten and I need to add a single variable to this: "http://www.mysite/(mycategory)

I don't know how to send the "mycategory" variable AND I don't know how to retrieve it.

Any help would be appreciated.

2 Answers 2

0

If you want one template that looks the same for all of your categories, you do not need to do anything with regexes or $_GET variables. Just use an archive.php template within your theme, as detailed in the Codex.

1
  • I tried what you asked but it didn't help me for what I needed. Maybe I didn't understand your answer right. If so, I'm sorry and thank you for your help
    – Baylock
    Commented Oct 24, 2012 at 0:28
0

What I did is rewrite url's in order to display the categories on them. After that, I just extracted them with the function "get_category_by_path". It allowed me to use the url info without having to inject and extract any custom variable. Thank you.

1
  • Please update your answer with the code that you used. Commented Oct 24, 2012 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.