I have posts that use a custom field for start date and end date.
query_posts
returns an array of posts that exist in the category I’m filtering.
How do I query posts using this custom field that has date i.e. 03/11/2010 and not the full array. Pagination works on the full array so it returns all posts. I can use an if else to only show the posts newer that today, then pagination doesn’t work.
Would I have to build a custom mysql query?
Leave a Reply
You must be logged in to post a comment.
Then you would access $pageposts as an object
You can create custom query using following filters
query_vars
,posts_join
,posts_where
,posts_groupby
.here’s the codex link to custom queries.
Some examples are listed there for help.
You can do this with
WP_Query
usingmeta_query
.By default it will search for published posts.
I would also suggest to store date in yyyy/mm/dd format. Sorting by this field will be much easier if you do this so.