query results by get_post_meta value
-
Hi All:
I am having a bit of a challenge trying to determine how to query my posts based on a meta value. I am using Flutter (tied to Post category for “Jobs”, catid=11) and created a write panel for job openings and one of the select values is the “city”. Using the menu feature in WP 3.0 I created a side menu with static links (titled by city) that point to my page template as follows:
http://my-wp-site.com/about-us/careers/current-openings.html?city=Atlanta
Ideally I would like to create a slew of menu items that each pass a variable (?city) to my page template and then use that value to query the meta data for the post to list only the posts for that city. I am using the following code to grab all posts and it works fine but for the life of me cannot figure out the syntax to get only the values from the meta data to list only for the requesting city.
<h2><?php echo $city; ?></h2> <ul style="list-style-type:none;"> <?php query_posts('cat=11&posts_per_page=10&order=DESC');?> <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?> <div> <li><p><h3><a>?postID=<?php the_ID(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3></p> </div> <?php endwhile; else: ?>
Any insight would be extremely helpful. Thanks in advance for looking!
- The topic ‘query results by get_post_meta value’ is closed to new replies.