WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a field on the admin side where a user enters a number for a price. If a user enters 1000000 I'd like to be able to display on the front-end $1,000,000.

Any ideas on how to accomplish this?

Edit More details, the post is a custom post type 'property'.

To add the meta fields on the back-end I'm using Meta Box Script, http://www.deluxeblogtips.com/2011/03/meta-box-script-update-v30.html

The code to display the numbers on the front-end I use

$meta = get_post_meta(get_the_ID(), 'rw_propPrice', true); echo $meta;
share|improve this question
up vote 3 down vote accepted

To format number, you can use the function number_format_i18n (it's not documented now, but you can see its source here). Its work is format the number based on the language. You might want to look at number_format (PHP built_in function, and is used by number_format_i18n) to have more control to decimal point and thousand separator.

In your case, this code will help you:

$meta = get_post_meta(get_the_ID(), 'rw_propPrice', true);
echo '$' . number_format($meta, 0, '.', ',');
share|improve this answer
thanks, for the answer, for your blog, the Meta Box Script... everything, it's been a huge help with my first wordpress project – Chuck Jun 17 '11 at 1:43
You're welcome :) – Rilwis Jun 17 '11 at 3:15

Just a guess (you really need to be more specific in your Q - what screen, how did you add it, metabox/settings section/bla???)...

$foo = get_option( 'your_option_name' ); 
echo '$'.$foo['bar']; // where bar is the searched value in the options array
share|improve this answer
I have added more details, I figure I can add the dollar sign in between echo and $meta; but still not sure how to add comma's. Thanks. – Chuck Jun 17 '11 at 1:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.