Ok so I have an events custom post type with a event-date (hyphen no underscore) custom field.
add_action( 'init', 'event_rewrites' );
function event_rewrites()
{
add_rewrite_rule( 'events/day/(\d{4}-\d{2}-\d{2})/', 'index.php?post_type=event&event-date=$matches[1]', 'top' );
}
add_filter( 'query_vars', 'event_vars' );
function event_vars ( $vars )
{
$vars[] = 'event-date';
return $vars;
}
With some help this is what I have so far which I think should produce: domain.com/event/day/2011-07-28, and it should use archive-event.php as its template file which I also have. To test this I placed:
?php $page = (get_query_var('page')) ? get_query_var('page') : 1; ?>
<h1>Currently Browsing Page <?php echo $page; ?></h1>
So that I will see it work when it does. Right now if I go to mydomain.com/event/day/2011-07-28 it gives me a Page Not Found error. It looks like its working right but then the lame page not found.. any ideas?
EDIT: so after posting I tried running the query in the url so: domain.com/?post_type=event&event-date=2011-07-21 and it returned the query var and showed "Currently Browsing Page 1" which is there due to the h1 in the archive-event.php...