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.

What's the best way to check current url for endpoint in a template file? I have a plugin that creates endpoints in author.php... so now i'm trying to check in author.php so that only certain code is executed if the URL ends in a specific endpoint?

example.com/author/username/endpointA

example.com/author/username/endpointB

The idea is that each endpoint has different content.

Thank you!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Check out this tutorial for query variables: http://www.rlmseo.com/blog/passing-get-query-string-parameters-in-wordpress-url/.

Essentially what you will be adding is a custom query variable with value either A or B to show different content. I.e. /author/username/contentA is actually index.php?author=username&customqueryvar=contentA.

share|improve this answer
    
Looks promising, i'm currently using this code: gist.github.com/705545 Any idea if there is anything in there that I can call in my template? The example you linked to uses "query_vars" to set custom variable, but i don't see that here. –  Pwn Mar 25 '11 at 0:17
    
Ah no - different solution, I've never seen that one before - query var is pretty straightforward, but it depends what you need to do. If it is just the A/B and you can't get the other working give it a go. –  Chris Mar 28 '11 at 10:43

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.