cost of the item in classifieds

The custom field in classifieds for cost of the item does not indicate any currency. I would like to add my own country currency.

Also I want to validate the same field to numerics only.

Please guide as to how can I do the above?

  • Ash

    Hello @Pooja

    I hope you are well today.

    For that you need to find the ID of cost custom field. When you create a classified or edit, right click on the text box for cost in chrome browser and select Inspect Element, you will get the ID. Please check screenshot.

    Then use the following code:

    add_filter( 'ct_shortcode', 'set_currency', 20, 3 );
    function set_currency($result, $atts, $content) {
    	if( $atts['id'] == '_ct_text_4cfeb3eac6f1f' )
    		return "$ " . $result;
    	return $result;

    _ct_text_4cfeb3eac6f1f needs to be replaced with the ID you get. $ should be replaced with your currency.

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.