WP_Query and Custom Fields
-
I’m trying to make a featured story at the top of my wp blog. I’m marking the stories I want to be featured with a customfield called “featured” with a value of true. In my header.php file I’m trying something like this:
<?php $my_query = new WP_Query('meta_key=featured&meta_value=true&showposts=1'); while ($my_query->have_posts()) : // Display post information endwhile; ?>
unfortunately, this is just displaying the latest post, regardless of the custom fields.
Also, later on within my main loop, I’d like to denote stories that were featured, but are now older. Is there and easy way to check a key/value pair from a post within the loop? Thanks.
- The topic ‘WP_Query and Custom Fields’ is closed to new replies.