[wp-hackers] advice on custom field post-query
Sharon Chambers
sharon at BrewerRadio.com
Mon Oct 12 18:40:00 UTC 2009
I was hoping to find some advice on how best to achieve what I’m trying to do…
I’ve got two custom fields: _bec_beginning, _bec_expiration
I’m trying now to structure a query that will give me all posts for a date that is within the range of _bec_beginning to _bec_expiration. What I’m trying is not working:
“showposts=$limit&post_type=post&meta_key=_bec_expiration&meta_compare=>=&meta_value=$date&meta_key=_bec_beginning&meta_compare=<=&meta_value=$date”
Where $date is, of course the date in question.
I’m not entirely sure it’s possible to query_posts in this fashion, using two custom fields, and I’m not confident that the meta_compare works quite right either.
I suppose I could write some sql to achieve my goal and query the post table directly, but I would rather use Wordpress method to achieve. Could use some advice.
Thanks,
Sharon Chambers
Webmaster
brewer media
1305 Carter Street
Chattanooga, TN 37402
(423)242-7652 office
(423)266-2335 fax
Sharon at BrewerMediaGroup.com
Brewer Broadcasting:
Power 94.9 | Groove 93.7 | ESPN Chattanooga 105.1 | Pulse News 95.3
Brewer Interactive:
BOGONooga.com | ChattanoogaLivesGreen.com | ChattanoogaHasFun.com | ChattanoogaHasCars.com | ChattanoogaHasTravel.com | ChattanoogaCrime.com
Brewer Publishing:
ChattanoogaPulse.com, The Pulse - Chattanooga's Alternative Weekly Newspaper
Chattanooga Traffic Network:
17 Radio Stations | 3 Television Stations | Traffic Reports & Sponsorships
More information about the wp-hackers
mailing list