function jnews_meta_views( $post_id = null, $range = null, $number_format = true ) { $total = apply_filters( 'jnews_get_total_fake_view', 0, $post_id ); return jnews_number_format( $total ); } function jnews_number_format( $total ) { if ( $total > 1000000 ) { $total = round( $total / 1000000, 1 ) . 'M'; } elseif ( $total > 1000 ) { $total = round( $total / 1000, 1 ) . 'k'; } return $total; }