Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My wordpress posts have a city/state combo in the post meta.

I want to create a list of cities with published posts from the post meta.

How would I go about this?

share|improve this question

migrated from stackoverflow.com Nov 11 '11 at 23:49

This question came from our site for professional and enthusiast programmers.

1 Answer 1

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

share|improve this answer
    
Jeremy's answer is a good one, and the way you should head if possible. If you absolutely need to continue using postmeta (i.e. it exists and there is resistance to moving it), please provide some more details about the postmeta (i.e. key names, possible value examples) and how you want to display it (i.e. do you want to show a count of posts for each city with a link to posts that have that meta, or just display the info in some way). –  brandwaffle Nov 11 '11 at 18:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.