How to convert a standard text field into a currency field using jQuery MaskMoney

If you’re looking to have a currency (or pricing) field type while using the WP Job Manager Field Editor plugin, even though there isn’t a currency field type, it is still possible with a little bit of code.

Before doing anything below, I strongly recommend checking out the jQuery plugin that will be used for turning the standard text field into a currency field, and make sure it has the options and support that you’re looking for (this is the best i’ve found so far, if you find something better, please let me know!)

Available options for configuration can be found here:

Setting it up

The first step you will need to create a standard text field that will be used as the currency field.  Select the Text Box field type, and setup the field like you normally would.

Once you have the field configured as you want it, the next step is to add the code below to your child theme’s functions.php file.  Make sure you read all the comments, and update/add any configuration options you may wish to use.

You MUST update the YOUR_META_KEY value to match your meta key (do not remove the #)

As long as you configured and set everything up correctly, you should now a field on the frontend that is formatted based on your configuration!  In the example image below, I setup a custom field, company_income, and set the thousands value to , which then produces this output:

Currency Field Example

Currency Field Example




Output on listings

The jQuery plugin used above is specifically for the display and format of the input field, the value actually saved to the listing/post, does not include any of the formatting, currency suffix, etc.  If you wish to format the output of that field, you will need to use PHP to do this for you, and output it on the listing.  Luckily enough, if you’re using one of my built in output methods to output this field, you only need to add some code to filter the value before it is output.  This supports the auto output, shortcode, widget, and even PHP functions included with the plugin!

Here’s example code to add to your child theme’s functions.php file that will filter

Make sure to read the comments for specifics on how you can customize the format, and voila!

Total 0 Votes

Tell us how can we improve this post?

+ = Verify Human or Spambot ?