I'm starting to work on a new project for which I will be using WordPress to facilitate content management. I have some experience building WordPress themes but it has been mostly related to page templates. This time, however, I need to dig deeper into the way posts are stored and retrieved from the database.

The page will be about listing sports facilities in different places, so basically, my posts need to have the following attributes:

Location (Country > State > City > Suburb) Category (Football, Baseball, Basketball, etc) Rating (According to users voting) First, I need to filter by city. This means, when a user gets to the homepage, I want to display posts in his city only. From the homepage, I want users to be able to browse by suburb, category and rating.

I have been reading about taxonomies, post_meta, etc, but I'm still not clear on how to organize the data inside the wordpress database so that I can later retrieve it filtering by the different categories mentioned before.

One option would be to use wordpress category to differentiate between sports, and tags to differentiate between locations, but this doesn't seem very elegant and wouldn't allow me to keep a hierarchy between countries, states and cities.

Any guidance toward the specific topics I should be reading would be enormously appreciated. Thank you very much in advance.

  • Does the country/state have any place in the filtering? It looks like the only filters you need are city and then either suburb/category/rating? – RachieVee Dec 9 '14 at 18:16

At first you have to catch visitors location. There are many plugins to catch visitors location such as "WassUp Real Time Analytics"

Also you have to create post custom fields for location.

Then you have to create a filter system in homepage that will check your post location field. After checking which post will be matched with visitor's location that will display in home page. After that you can use post query for different categories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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