Adding post types like cities and zipcodes to admin panel

I know I can create a custom post type – but that seems like overkill.

Why are you thinking like that I don’t know. A custom post type is a simpler and easier way to sort out data of a specific type.

You can also go for the default post types: post or page with Custom Meta Fields for saving specific information like cities and zip code.

I don’t know what your site’s purpose is, how you are using the default post types etc.

I can suggest an easier way:

  • Use the default post type: post
  • Make a new category like: Address
  • Install Advanced Custom Fields plugin
  • Create new custom field-set with 2 fields: (1) Cities – textarea, (2) Zipcode – text
  • Now use the following location-combination:
    Advanced Custom Fields combination
  • Take the post title as a notation of the place

Using it is soooo easy that, it will show your custom fields only when the specific category (i.e. Address) is selected. And you can hide unnecessary fields when the “Address” category is selected.

After doing all of ’em, to show the data you just put using these fields, use a query on the front end using get_post_meta( $post->ID, 'your_key', true );, and show the data accordingly.