WP Residence Help WP Residence Help

  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API
Home / Technical how to | Custom Code Required / Technical – Add new measurement unit

Technical – Add new measurement unit

4003 views 0

How to Add a Custom Measurement Unit in WPResidence

WPResidence does not currently include a custom unit field in Theme Options by default.

The available measurement units are predefined in code, such as ft, m, ac, yd, and ha. If you want to add a different unit, for example kanal, this requires code changes in the core unit arrays and conversion tables.

Important

This is a custom code modification. It is not available as a built-in theme option.

The following information is provided only as a technical guide for developers. The example code is not tested and should be reviewed carefully before being used on a live website.

Files to Update

In the current structure, the custom unit must be added in the files below.

1. wpresidence-core plugin: admin-config.php

File:
plugins/wpresidence-core/redux-framework/admin-config.php

In this file, add the new unit to the following arrays:

  • $measure_array
  • $measure_array_lot_size

This makes the new unit selectable in Theme Options for both Property Size and Lot Size.

2. wpresidence-core plugin: convert_functions.php

File:
plugins/wpresidence-core/api/inc/convert_functions/convert_functions.php

In this file, you must:

  • Add the new unit in all measurement arrays used for conversion and formatting
  • Add the matching entries in the recalculation tables so the unit conversion works correctly
  • Update the logic that decides whether ² is appended for square-based units

This is the main file that controls how units are displayed and converted in the latest theme versions.

3. Theme file: widget_functions.php

File:
wp-content/themes/wpresidence/libs/widget_functions.php

If you use the Measurement Unit widget, add the new unit to the widget dropdown array in this file as well.

About the Old sup2 Note

In older notes, the recommendation may have been to edit a helper function to remove <sup>2</sup>.

In the latest theme versions, this is no longer the main path.

At the moment, the display of ² is controlled mostly in convert_functions.php and in the widget output logic, while the submit form labels now rely on the formatted unit functions.

After the Code Update

After adding the custom unit in code, go to:

Theme Options > Measurement Unit

Then select the newly added unit for:

  • Property Size
  • Lot Size

Save the changes and clear all cache layers, including any cache plugin, server cache, or CDN cache if enabled.

Developer Note

The following code changes are custom and are not part of the default WPResidence functionality.

Any implementation should be tested carefully in a staging environment first and reviewed by a developer before deployment on a live website.

Technical how to | Custom Code Required

Related Articles

  • Technical: Change the Schedule Tour Email Text and the Form Default Message
  • Property list filter customization
  • Technical – How to Change the Minimum Image Dimensions for Property Uploads in WPResidence
  • Introduction to WPResidence Header Customization

Help Categories

  • 18Agent, Agency & Developers
  • 5Blog Posts & Blog Lists
  • 39Elementor Shortcodes Built-In
  • 53FAQ
  • 15Footer
  • 5Getting Started
  • 37Header
  • 2IDX & MLSImport
  • 6Installation & Setup
  • 24Installation FAQ
  • 23Maps & Location Settings
  • 21Multi-Language - Third Party Plugins
  • 6Other Third party Plugins
  • 21Pages
  • 4Payments & Monetization
  • 20Property Lists, Categories & Archive
  • 37Property Pages & Layouts
  • 32Search & Filtering
  • 162Technical how to | Custom Code Required
  • 8Technical: Actions and filters
  • 7Technical: Child Theme
  • 86Theme Options & Global Settings
  • 7Translations & Languages
  • 16WPBakery Shortcodes
  • 50WPEstate / WPResidence Translate Plugin
  • 51WPResidence / WPEstate CRM
  • 50WPResidence 5.0 Documentation
  • 9WPResidence Elementor Studio

Join Us On

Powered by WP Estate - All Rights Reserved
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API