Support » Plugin: Estatik Real Estate Plugin » Comma separator

  • Hi!
    How to change separator from dot to comma? I still need it for flat area or lot size area.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Estatik

    (@estatik)

    Hello!
    Thank you for your request.
    You can use str_replace function for replace comma with dot in es_get_the_formatted_field, es_get_the_area, es_get_the_lot_size filters. As a result Area and Lot size fields will display dots as delimiters in website front-end.
    Regards,
    Estatik.

    Thread Starter Rafał

    (@ayek)

    Dot → Comma
    Eg. 120.55 m² → 120,55 m²
    File:
    \wp-content\plugins\estatik\templates\property\fields.php
    copied as:
    \wp-content\themes\my-theme\estatik\property\fields.php

    Line: 17
    <?php $value = is_array( $field[ key( $field ) ] ) ? implode( ', ', $field[ key( $field ) ] ) : $field[ key( $field ) ]; ?>
    changed to:
    <?php $value = is_array( $field[ key( $field ) ] ) ? implode( ', ', $field[ key( $field ) ] ) : str_replace('.',',',$field[ key( $field ) ]); ?>

    Works for me.
    Could do better?

    Thread Starter Rafał

    (@ayek)

    Better to use preg_replace function, so:

    <?php $value = is_array($field[key($field)]) ? implode(', ', $field[key($field)]) : preg_replace('/(\d)\.(\d)/', '\1,\2', $field[key($field)]); ?>

    Find a dot between two digits, then replace.

    Plugin Author Estatik

    (@estatik)

    Thank you for your reply, Rafał!
    Your modifications should work fine within one section – Basic facts. So, for example if you move Area and Lot Size fields to another section, the dot delimiter will appear again.
    Regards,
    Estatik.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.