: How to add geographic taxonomy for posts? I'd like to know what you guys think is the best way to go about creating a geographic taxonomy for a website (disclaimer: I run Wordpress, but more
I'd like to know what you guys think is the best way to go about creating a geographic taxonomy for a website (disclaimer: I run Wordpress, but more universal standards are welcome).
Serving content based on location is not a primary concern, rather I'd like to simply be able to attach a location to every story, kind of like news-agencies do, in order to later be able to run specific search filters or display stories on a map etc.
I have tried the popular plugins in the WP repository, but they all feel more or less like dead-end streets, with much needed to make them work as intended and much of the existing functionality to be left out. It would be neat if one could just pin the story on a map and then have the plugin take care of the taxonomy and everything, but this doesn't seem to be the case. Unless I missed anything, I think it's safer to just build something simpler from scratch.
The straightforward way to go about this would be to create a hierarchical custom taxonomy, with country > region > city etc. (maybe using the full names of places but with ISO 2/3 letter codes as slugs, for easy processing in maps etc.)
However, I'm not sure how future-proof this would be. Is there a better standard out there or in the works? I want to at least be able to easily switch to the new standard in case it'd ever arise. Or does Wordpress have anything cooking that I should be prepared for?
More posts by @Sarah324
1 Comments
Sorted by latest first Latest Oldest Best
Broadly speaking, there are two ways to approach this.
If you are going to use standard posts, instead of using categories and tags, I would steer you towards custom fields and build your geolocation stuff that way. It would not be strictly hierarchial nor would it reflect in the post slugs but it would be available to a good search plugin for filtering.
The other way to go would be to create a custom post type for these stories and that will give you the freedom to create as many taxonomies as you want or need to make. These can be hierarchial or not and can also be used in the story slug and this approach would be my preference due to the SEO benefits of getting the location names into the URL.
Either approach would be able to expose the data for map processing and should be relatively future-proof so long as the people entering the data stick to whatever schema you come up with.
As far as plugins go, you wouldn't really need any to accomplish adding custom fields or post types; that's just knowing standard WordPress functions. If you are not comfortable with code, then you could look into Advanced Custom Fields and Easy Content Types to provide an admin interface for both objects. Manipulating search is a bit of a different story. To provide easy faceted search and filters I strongly recommend FacetWP. It can be used to almost instantly generate filters from any taxonomy or custom field.
Edit: May 2016
Also have a look at the Geo My WP plugin and its add-on library. This plugin does an admirable job of geocoding just about anything on a WordPress site. It can do the geocoding on post creation, from custom fields, etc.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.