WP Residence Help WP Residence Help

  • WpEstate
  • How to Build Your Website
  • Video Tutorials
  • Client Support
  • API
Home / Technical how to | Custom Code Required / Technical how to : Custom fields

Technical how to : Custom fields

6006 views 0

The custom fields for properties are saved as an wordpress theme option. In order to view them all you can use this code

$custom_fields = wpresidence_get_option( 'wp_estate_custom_fields', '');
print_r($custom_fields);

***the code above is not for production sites

If you did print the custom fields arrays you will see that we have stored the name, the label, type, order in the list and dropdown values if is the case. More exactly:
$name = $custom_fields[$i][0];
$label = $custom_fields[$i][1];
$type = $custom_fields[$i][2];
$order = $custom_fields[$i][3];
$dropdown_values = $custom_fields[$i][4];

The custom fields are saved in user_dashboard_add.php (for front end submission) around line 820 for save and line 1420 for edit:

for ex: update_post_meta($post_id, $slug, $value_custom);

Before saving the fields are filtered for html code and ordered. If you want to allow new html tags you need to add those tags into

$allowed_html   =   array();

around line 29.

or use

$allowed_html_desc from line 26 (which holds permission for html in description)

or

just create a new set of array with permitted html tags and use that

See how wp_kses function here : https://codex.wordpress.org/Function_Reference/wp_kses

 

The custom fields are displayed in wp admin using function custom_details_box in wp-content\plugins\wpresidence-core\post-types\property.php and on front end page using function estate_listing_details located in wp-content\themes\wpresidence\libs\listings_functions.php

If you want to display a custom field value and you don;t know it’s name you should open a property page in wp-admin with Chrome, right click and chose inspect element. The name of the field is the actual name of the input html element like in the screen capture below.

inspect_cusotm_field

use this PHP function to print a custom field in a different location

get_post_meta($ post-> ID, 'custom_field_name', true);

MORE in wordpress codex  – https://codex.wordpress.org/Function_Reference/get_post_meta

Property Default Fields name List

Price ->  property_price

After Price Label(*for example “per month”): -> property_label

Before Price Label(*for example “per month”): -> property_label_before

 

Technical how to | Custom Code Required

Related Articles

  • Technical – How to Change the Minimum Image Dimensions for Property Uploads in WPResidence
  • Introduction to WPResidence Header Customization
  • Understanding WPResidence Header Types: An Overview
  • Customizing the WPResidence Logo Display

WP Residence Documentation

  • 1. General
    • How to Get Support
    • Get your buyer license code.
    • Use SSL / https
    • Server / Theme Requirements
  • 2. Installation
  • 3. Installation FAQ
  • 4. Advanced Search
    • Advanced Search Display Settings
    • Advanced Search Form
    • Geolocation Search for Half Map
    • Save Search Theme Options
    • Advanced Search Colors
  • 5. Agent, Agency & Developers
  • 6. Property Page
  • 7. Properties List
  • 8. Property Taxonomies
  • WpResidence Elementor Studio
  • 10. Blog Posts & Blog List
  • 11. Shortcodes
    • Contact Form
    • Featured Agency/Developer
    • Membership Packages
    • Testimonials
    • Google Map with Property Marker
    • Listings per Agent, Agency or Developer
    • Display Categories
    • Agent List
    • Recent Items Slider
    • Recent items
    • List Properties or Articles by ID
    • Featured Agent
    • Featured Article
    • Featured Property
    • Login & Register Form
    • Icon Content Box Shortcode
  • 12. Widgets
  • Theme Options
    • General Settings
    • User Types Settings
    • Appearance
    • Logos & Favicon
    • Header
    • Footer Style and Colors
    • Price & Currency
    • Property Custom Fields
    • Features & Amenities
    • Listing Labels
    • Theme Slider
    • Permalinks
    • Splash Page
    • Social & Contact
    • Map Settings
    • Pin Management
    • How read from file works
    • General Design Settings
    • Custom Colors Settings
    • Header Design & Colors
    • Mobile Menu Colors
    • User Dashboard Colors
    • Print PDF Design
    • Property, Agent, Blog Lists Design Settings
    • Sidebar Widget Design
    • Font management
    • How to add custom CSS
    • Custom Property Card Unit – Beta version
    • Email Management
    • Import & Export theme options
    • reCaptcha settings
    • YELP API Integration
    • iHomefinder Optima Express IDX
    • MEMBERSHIP & PAYMENT Settings
    • Property Submission Page
    • PayPal Setup
    • Stripe Setup
    • Wire Transfer Payment Method
  • Translation
  • FAQ
  • Pages
  • Header
  • Footer
  • Google or Open Street Maps
  • Payment Options
  • Plugins
    • Included Plugins
    • Third Party Plugins – IDX Compatibility
    • Third Party Plugins – Multi Languages
    • Third party Plugins – Other
  • Technical
    • Technical how to | Custom Code Required
    • Technical: Child Theme

Join Us On

Powered by WP Estate - All Rights Reserved
  • WpEstate
  • How to Build Your Website
  • Video Tutorials
  • Client Support
  • API