Need a function call that is designed solely to get the count of posts matching a criteria. I believe the get_posts() function is too expensive for this operation. I'm merely trying to decide whether or not to show a "View More Posts" link when there are a predefined number of posts to display...
For example, the default number of post links to display is 3. I only want to show a "View More Posts" link if the total number of posts exceeds 3.
Here's my code...
$cat1=get_cat_ID('test');
$cat2=get_cat_ID('test2');
$myposts = get_posts(array('cat' => "$cat1,-$cat2",'showposts' => 3));
$myposts2 = get_posts(array('cat' => "$cat1,-$cat2"));
$mypostcount = count($myposts2);
foreach($myposts as $idx=>$post)
?>
<li><a>Post Info Goes here</a></li>
<?php
if ($mypostscount > 3){ ?>Show View All Link<?php ?>