Your address will show here +12 34 56 78

Home Forums WP RESIDENCE – Real Estate WordPress Theme FORUM Change Price Field from NUMBER to TEXT in WP Residence

This topic contains 0 replies, has 1 voice, and was last updated by  Camelia Support Team – WP Estate 2 years, 2 months ago.

  • Author
  • #117591

    When it comes to price, search can work only for number fields – as originally designed in the theme. Do this change and search will not work anymore for price.

    For property page you need to edit single_estate-property and look for this

    $price = intval ( get_post_meta($post->ID, 'property_price', true) );

    remove intval – should end up with something like

    $price = get_post_meta($post->ID, 'property_price', true) ;

    you should do the same thing also for all theme files where price is listed.


    in single_estate-property.php

    replace the $price definition with this code

    $price          =   esc_html ( get_post_meta($post->ID, 'property_price', true) ); 

    Comment this code

    //if ($price != 0) {
                  // $price = wpestate_show_price(get_the_ID(),$currency,$where_currency,1);  
                  // $price='';
              // }

    In libs/property.php you make sure you made the change so price can save in text.

     $price = get_post_meta($post->ID, 'property_price', true) ;

    And that will allow you to list text where price is on property page – next to title.

    In property_unit.php


    $price = esc_html ( get_post_meta($post->ID, 'property_price', true) );

    Edit existing code like this

    print $price.' '.$price_label; 

    You must track all the other places where price is defined as floatval and make the changes instructed in forum and in this post.

    Thank you


    Add before price label:

    To not affect the search by price – as this change will affect search by price – you can look for the code and simply add “text” in front of the price.

    You can also look at the code –┬áproperty_label (do a theme search by this field) which is the after price label (that shows after price) and move it before price.


    Other default fields for which you may wish to apply the same change are listed below. You must do a theme search by the fields names in bold to find all the places where the change must apply:

    Bathrooms: property_bathrooms

    Property size: property_size

    Property lot size: property_lot_size

You must be logged in to reply to this topic.