Title: PHP Code
Last modified: June 23, 2022

---

# PHP Code

 *  Resolved [USREC](https://wordpress.org/support/users/hawaiirealestate/)
 * (@hawaiirealestate)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/php-code-76/)
 * Why won’t this code work?
    <?php $x=es_the_property_field( ‘price’, ‘<p>Price:‘);
   $y=$x *= .015; echo $y; ?>

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Rafał](https://wordpress.org/support/users/ayek/)
 * (@ayek)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/php-code-76/#post-15766684)
 * If you want to do math operations, then you should **get** the `price` only
 * `es_get_the_property_field('price')`
 *  Thread Starter [USREC](https://wordpress.org/support/users/hawaiirealestate/)
 * (@hawaiirealestate)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/php-code-76/#post-15769047)
 * Trying
 *     ```
       <?php
       $x = es_get_the_property_field('price');
       echo $x;
       $x=intval($x);
   
       if (is_numeric($x) ) {
       echo "X is a number: ";
       echo $x;
       echo number_format("$x",2)."<br>";
       } else {
       echo "X is not a number.";
       }
       ?>
       ```
   
 * But wont show Price, only X is a number: 00.00
    -  This reply was modified 3 years, 9 months ago by [USREC](https://wordpress.org/support/users/hawaiirealestate/).
 *  Thread Starter [USREC](https://wordpress.org/support/users/hawaiirealestate/)
 * (@hawaiirealestate)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/php-code-76/#post-15776199)
 * Anyone use PHP or Javascript?
 *  [Rafał](https://wordpress.org/support/users/ayek/)
 * (@ayek)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/php-code-76/#post-15777380)
 * Probably it depends on the place you want to fetch the `price`
    I’ve created 
   my customization by copying template `\wp-content\plugins\estatik\templates\content-
   single.php` to `\wp-content\themes\my-theme\estatik\content-single.php`
 * `es_get_the_property_field('price')` gives me an **integer** (if I set the price
   of property with decimal separator, then it gives float / double).
 * Seems that your code is placed out of scope – you get NULL there, then converted
   to integer gives you 0. So checking (after changing the type) if the variable
   is numeric or not makes no sense.
    -  This reply was modified 3 years, 9 months ago by [Rafał](https://wordpress.org/support/users/ayek/).
 *  Thread Starter [USREC](https://wordpress.org/support/users/hawaiirealestate/)
 * (@hawaiirealestate)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/php-code-76/#post-15783344)
 * Keep getting
 * Fatal error: Uncaught Error: Undefined constant “‘price’”

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘PHP Code’ is closed to new replies.

 * ![](https://ps.w.org/estatik/assets/icon-256x256.png?rev=2819514)
 * [Estatik Real Estate Plugin](https://wordpress.org/plugins/estatik/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/estatik/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/estatik/)
 * [Active Topics](https://wordpress.org/support/plugin/estatik/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/estatik/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/estatik/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [USREC](https://wordpress.org/support/users/hawaiirealestate/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/php-code-76/#post-15783344)
 * Status: resolved