[wp-hackers] Get query variables and tags
Ade Walker
photofantaisie at gmail.com
Mon Feb 2 23:38:26 GMT 2009
Hi all,
I would be very grateful to get a pointer or two for this, please.
I have a single post template with a sidebar which is to be populated with
links to other posts (from the same category). Each post has various tags
assigned to it. If the user clicks a tag, which are listed on the page using
the_tags(), I want the sidebar list of posts to only reflect posts which
have the same tag.
I was thinking that if I could access the query string and identify which
tag had been clicked, I could then run a wp_query to pull posts with the
same tag.
So, my questions are (1) how do I grab the query string to identify which
tag had been clicked, and (2) would I use get_the_tags() to filter the
results of the wp_query?
I have a feeling I'm either oversimplifying what is required - or
over-complicating it! So any pointers would be very gratefully received.
Thanks in advance.
Ade.
More information about the wp-hackers
mailing list