WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just did a redesign of my site, AlpineZone.com. I worked with a WP developer on the completion of the site. One thing that was done that I'm not entirely happy with is the way the Resorts section is handled.

Here is an example resort: http://www.alpinezone.com/resorts/sugarbush/

I'm 100% happy with the way it looks. The site used to be in standard PHP and all the data was stored in a tab delimeted file that was read by a PHP script. The tab file was updated in Filemarker Pro and updated. This means that it was in a tabular format so I could easily search for records; find resorts that had X number of lifts or between X and Y vertical feet, etc. basically I had a lot more flexibility in parsing the information.

However, the "data" in the new format comes from the Postmeta table. I believe the fields are done using a plugin called Advanced Custom Fields. As far as I can tell, it's not easily queryable or searchable.

I have other areas of the site, like the Map (http://www.alpinezone.com/skiing/ski-resort-map/), that I would like to pull information from the same source, so I don't need to maintain two sets of records for each resort. Right now the Map is still pulling from the same Tab file it did before. But this means I have the risk of resorts in the Resorts section falling out of sync with the resorts on the Map since the data sources are disparate.

basically: is there a way to create a series of pages based on a table of data with each record becoming a new page and the fields being populated into a page structure? Then, I could update the records by just updating the table and it gives me the other benefits of having a table structure (querying, sorting, advanced searching, and ultimately easier expansion (e.g. if I want to add a new field I don't have to add to 140+ resorts manually I can add a field, update the page template to include that field, and then just populate the fields in the table.).

Edit: i found this; http://www.myreviewplugin.com/importman.html, which kind of sounds like what i want except it is part of this larger package I don't need.

Thanks! -Nick

share|improve this question
up vote 1 down vote accepted

You can indeed query on post metadata, see Custom Field Parametersfor WP_Query in Codex. I would recommend against using a custom table.

EDIT - Here's an example query for all resorts with meta key vertical_feet between 2000 and 3000:

$args = array(
    'post_type' => 'resort',
    'posts_per_page' => -1,
    'meta_query' => array(
            'key' => 'vertical_feet',
            'value' => array( 2000, 3000 ),
            'type' => 'numeric',
            'compare' => 'BETWEEN'
$query = new WP_Query( $args );
share|improve this answer
Thanks Milo ... is there a way for me to create a table view using the Postmeta table? I'm not great at SQL but I can get the results set I need with the following <----> SELECT a.id, a.post_type, a.post_title, b.post_id, b.meta_key, b.meta_value FROM alpinezone_postmeta b INNER JOIN alpinezone_posts a ON a.id = b.post_id WHERE a.post_type = "resorts" <-----> I would then need to find a way to take each unique meta_key and make it a column where each record on that is grouped by post_id (since each post_id is a resort) – Nick Jul 25 '12 at 16:30
@Nick you could query for all resort posts via WP_Query and then get_post_customfor each post to output all metadata. Also see my edit above for a query using one of your examples: find resorts between X and Y vertical feet. – Milo Jul 26 '12 at 3:01
I ended up getting a view created! Was tricky but figured it out on Stack OVerflow --> stackoverflow.com/questions/11654632/… – Nick Jul 27 '12 at 16:34

Your Answer


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

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