Can’t you just add the city/state as a tag. Then you could add the tags accordingly to show the required ones for the related posts. You could then use them in your template with:
<?php the_tags(); ?>
Form more info about tags see the codex page:
WordPress Tags Codex Page
If you need more control you might consider using taxonomies:
http://codex.wordpress.org/Taxonomies
Related Posts:
- How to display SQL query that ran in query?
- How to tune search argument in WP_Query to show only exactly the same results?
- Very slow query
- Search Terms – Querying on either description__like OR name__like in the same Term Query?
- How to get my loop to pull posts into three columns
- Custom $wpdb Query for Custom Post Type by Category
- Count user posts by user ID, Post type and Post status
- Can’t pass table to $wpdb->prepare
- How to get category link without a database query
- search through post-type attachments titles
- Date query year and month OR just year
- cron job to auto delete posts of a specific post type older than x days
- Are database queries created using WordPress filters protected from SQL injection?
- get post id using the $query_vars variable
- Most effective use of DB querys
- mysql query paging
- Two differents queries in archive page
- How do I find if a page has a template?
- How to set back query var author_name after unset it?
- How to check current user in meta value array in WP_Query meta_query
- My SQL function to change user_name
- How select a specific query when setting offset?
- How to retrieve elements from another table in a SQL query?
- Change media attachment author via mysql query
- WordPress Loop: List All Posts by a Category & Subcategory
- Order query by post meta value
- List all posts from past week grouped by sub-category
- Query Custom Post Type posts by Keyword/url slug
- how would I create a custom query to get all users, and a related post based on a postmeta field?
- Display posts with a start OR end date later than current date
- Order posts by custom field DATE value
- sql select query in wordpress ‘page’ [closed]
- wpdb->term_taxonomy count posts from both published and private posts?
- Form redirect with query vars to page
- Query to Get All Users from wp_users With NO matching user_id In wp_usermeta
- WordPress custom setting page – add flashing message
- Custom query AFTER rss fetch_feed not working
- Attempt to improve WP search, can someone check my SQL query?
- WordPress Query orderby title with UTF8 string in title
- Searching With Apostrophe
- Multiple Category Query
- list all categories that have a certain word in title
- Passing parameters to a static front page
- wp_list_pages() refuses to output posts
- Can’t seem to do combined query AND sort?
- sort query results by newest
- How to reset usual $query on search page to push custom $wpdb query there?
- get_posts showing only 5 posts. (nopaging and posts_per_page -1 not working)
- Order by meta value pro first then meta value free in my search function
- Display posts between two particular dates
- Order posts by date, but also give priority for a specific term
- $post->ID not working in combination with a custom query
- How to delete all posts, categories and tags from WordPress database
- Ideas how to search & replace post_content when string contains a newline?
- Combine “Exclude” Query in functions.php
- Query the WordPress database to get data together with replaced information
- $wpdb->prepare affecting the query?
- WordPress SQL search, how to handle SQL Injection?
- Query for Custom Post Type UI Does Not Loop All the Post
- Updating with $qpdb->query() always returns 0 rows affected
- Wrap/close ‘query’ for a first-letter ordered listing of posts
- wpdb query with dynamic column name?
- How do you display the number of a post in a query?
- How to manage a particular “order by” for get_search_query()?
- Query to view scheduled or draft post
- How can I get the name of term post meta value which equals term id
- Trying to use WP_Query to return post with and without meta values
- Custom query Custom-Post-Types creates error
- Formatting a date/time returned from a custom $wpdb query
- get products by custom date variable
- How to delete all images from code in all post_content
- How to sort by two meta keys in admin area?
- Restrict WordPress search to a single ACF field
- wp query multiple values > display a specific value first
- PHP Fatal error: Uncaught Error: Call to a member function insert() on null
- SQL query to delete users with multiple meta keys and comments
- Nested select statements not working
- Pagination adds search query (again)
- Fastest and most efficient SQL query to check if UID exists
- Counting And Monitoring How Much Queries My Script Used
- Add Hook for clearing transient when post is added
- Run an update query in a function
- Add generic page to WP_Query
- Advanced Custom Fields Query with Different Values of the Same Key
- No results for taxonomy archive page
- search.php is not generating the right results
- Slow query when joining wp_posts with a lookup-table?
- Filter the feed page post limit
- Show links to child pages on both parent AND child pages
- Mysql query and odd results
- Using wp_list_table how to trigger update function “inline”?
- Filter multiple different main queries on custom pages
- Modify Global Posts Plugin
- How to reference same column name but different table in custom db query
- Retrieving custom field array value through db query
- WP_Query older new links navigation?
- How to get one result using wpdb class?
- Delete query won’t run
- Modify a query using both a text field and a true/false AFC field
- Admin Post List table Query filtering “WHERE” for custom post type