4

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?

1
  • 3
    I like the question. I have no clue as for an answer. I did want to warn you that this question is sounding a bit too close to a recommendation and may be closed. Can you edit it some to avoid this?? You have a lot of good stuff here. I would like to see you get an answer.
    – closetnoc
    Commented Jun 28, 2015 at 1:56

1 Answer 1

2
+50

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.

2
  • Thanks! Custom fields may indeed be a good option since they let you to just enter coordinates, for even more granularity than a fixed hierarchy of 2 or 3 terms. It would also be a lot of work to sort them out later, I'm still looking if there's a solid way to do it. Custom posts don't fit the bill, I want the taxonomy to be available and used for every single post there is. I can manually do a custom taxonomy/field/post easily - map placement is where I'd much appreciate the help of a plugin.
    – lucian
    Commented Jun 29, 2015 at 7:46
  • Advanced Custom Fields has Google Maps integrated... advancedcustomfields.com/resources/google-map
    – JCL1178
    Commented Jul 1, 2015 at 4:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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