If you save the return of query_post(...)
as a variable, and then run $var->found_posts
, does that give you the expected result?
Like so:
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$today = date('Y-m-d', strtotime('-1 hours'));
$query = query_posts(array(
'post_type' => 'post',
'paged' => $paged,
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query'=>array(
'relation'=>'AND',
array(
'key' => 'start_date',
'value' => $today,
'compare' => '<=',
'type' => 'CHAR'
),
array(
'key' => 'end_date',
'value' => $today,
'compare' => '>=',
'type' => 'CHAR'
)
)
));
echo $query->found_posts . " posts.";
if (have_posts()) :
while (have_posts()) : the_post();
If you adjust the compare-value in the query you should get the according result?!