taxonomy - Categorizing posts by location

admin2025-01-07  3

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.

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.

Share Improve this question edited Dec 8, 2014 at 23:38 Alex asked Dec 8, 2014 at 23:32 AlexAlex 1314 bronze badges 1
  • 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 Commented Dec 9, 2014 at 18:16
Add a comment  | 

1 Answer 1

Reset to default 0

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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736255700a302.html

最新回复(0)