To actually connect these fields to a Category would be tricky because the posts would have to change category automatically as dates change. Its not impossible though. You’d need a script to assign a category on post/edit and a script to reassign categories each day.
I think it would be easier and cleaner to create a new theme template for the display of your ‘available – soon – upcoming’ books. Inside the template, query the DB for ‘available’, ‘soon’ or ‘upcoming’ depending on circumstances and spit out the posts. I don’t think query_posts will do it for you because you’ll need to search the DB by date ranges, but it shouldn’t be a hard query to write.
Hmm sounds difficult.. actually my category.php loads theme templates like this:
//category.php
<?php
if (is_category(1)) {
include(TEMPLATEPATH . ‘/category-1.php’);}
?>
//category-1.php
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
So how to change that query to load post based on custom field values?
still havn’t found solution… anyone?
If you are storing the date in your custom field in a format such as year-month-day (e.g. 20091006 for Oct 10, 2009) then you can use the query_posts() Custom Field arguments to filter your dates. Otherwise you’d need to use wpdb and craft a SQL statement that does a join with wp_posts and wp_postmeta with a LIKE filter.