I would like to display the total number of posts and comments on my (Dutch) weblog. But the problem is: the php-code I use generates numbers with a comma (3,223 posts) instead of a period (3.223 posts).
Please help. This is the code I use (I’m an absolute php-newbie):
$numposts = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = ‘publish'”);
if (0 < $numposts) $numposts = number_format($numposts);
$numcomms = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = ‘1’”);
if (0 < $numcomms) $numcomms = number_format($numcomms);
$numcats = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->categories”);
if (0 < $numcats) $numcats = number_format($numcats);
<?php echo $numposts . ‘ columns
‘ . $numcomms . ‘ reacties ‘ . $numcats . ”; ?>
- The topic ‘How to generate comma’s instead of periods (dots)’ is closed to new replies.