Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top