I’m trying to filter my posts by category, then further by city. The only way I can think of filter by city is if the admin adds the city to the listed tags and then filtering from there via switch statement.
How can I filter posts by a certain tag?
Is there a better way to do what I’m doing?
My PHP knowledge is intermediate and my WordPress knowledge is pretty basic. Thanks in advance!
here you go,
The following returns all posts that belong to category 1 and are tagged “apples”
Add this inside the page before the loop
change ‘1’ and ‘apples’ to whatever category and tag you want.
If you must use
query_posts()
, make sure you callwp_reset_query()
after you’re done.look here for more info,
http://codex.wordpress.org/Function_Reference/query_posts