I have the following function:
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return __('0 View','mm');
}
return $count. __(' Views','mm');
}
How do I make it format a number to include a comma in the thousandths place? For example, 50000 should become 50,000.
Use
number_format():