I have a sentence like this:
<h5>There are <?php echo $total_results_count; ?> results waiting for you!</h5>
How could I modify this to say:
There is 1 result waiting for you!
if there is only 1 result.
<h5><?php
if ($total_results_count > 1) {
echo 'There are ' . $total_results_count . ' results';
}
else {
echo 'There is ' . $total_results_count . ' result';
} ?> waiting for you!</h5>
Get results into a variable. Then,
if($count == 1){
str_replace("are results","is 1 result ","There are results waiting for you!");
}
As easy as:<h5>There <?php if($total_results_count>1) echo "are"; else echo "is" $total_results_count. " result"; if($total_results_count>1) echo "s";?> waiting for you!</h5>
<?php
if( $total_results_count > 1 ) {
echo '<h5>There are '.$total_results_count.' results waiting for you!</h5>';
} else {
echo '<h5>There is 1 result waiting for you!</h5>';
}