Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

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.

share|improve this answer
    
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 Oct 24 '12 at 0:28
add comment
up vote 0 down vote accepted

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.

share|improve this answer
    
Please update your answer with the code that you used. –  Joseph Oct 24 '12 at 16:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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