I want display wordpress loop but I want only show count of items in the loop filtered by a custom field value. I don't want to show the title or the content, only the count. This is what I have:
<?php query_posts('meta_key=city&meta_value=Seelbach'); ?>
<?php $count = 0; ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php $count++; //increment the variable by 1 each time the loop executes ?>
<div>
<?php if ($count==1) {
echo "1";
}
elseif ($count==2) {
echo "2";
}
elseif ($count==3) {
echo "3";
}
elseif ($count==4) {
echo "4";
} ?>
</div>
<?php endwhile; endif; ?>
but the output is "1 2" - he shows each item and gives it a number but i only want to show the count of ALL (in this case 2 ... ) items that fit to my meta_value. that means i only want to show the "2".