Inspiry Menu Created with Sketch.
RELATED TO: Real Homes Theme

Basic Information section on Property Edit page of Real Homes Theme is a very important section to add/edit/remove the information about the Property. So, in this KnowledgeBase Article I am going to tell you how you can:

  • Add more options in Basic Information
  • Show them on property details page.

1) Adding More MetaBox Options

Many clients want to add more options in Basic Information section so it is not that hard if you will follow this tutorial carefully. So, the first thing to do is to add the following code in functions.php file of your theme.

add_filter( 'rwmb_meta_boxes', 'inspiry_edit_property_meta_boxes', 20 );

function inspiry_edit_property_meta_boxes( $meta_boxes )
{
 foreach ( $meta_boxes as $k => $meta_box )
 {
 if ( isset( $meta_box['id'] ) && 'property-meta-box' == $meta_box['id'] )
 { 
 $meta_boxes[$k]['fields'][] = array(
 'id' => 'example_id',
 'name' => __('Example Name', 'framework'),
 'desc' => __('Example Description', 'framework'),
 'type' => 'text',
 'std' => "",
 'columns' => 6,
 'tab' => 'details',
 );
 }
 }
 return $meta_boxes;
}

There are some important things to understand here which you have to change before adding this code in functions.php file. You have to change the following variables from the code and those variables are:

  • The id which is example_id so you have to change the example_id.
  • The name which is Example Name so kindly change Example Name.
  • The type which is text, there are multiple types you can choose from text, checkbox, map etc. To learn more about meta-box types please read this article.

Once you have changed these variables from the code then you can add it to functions.php file and it will add a new field into Basic Information section. As for our code, it displayed like this:

2) Displaying the new Metabox section on Property Details page

Now that the option has been added and working on the backend we can safely display it on front-end. To display it on Property Details page you have to decide in which section you want to show it because we have broken down the code for all the sections into different files which can be found in wp-content > themes > realhomes > property-details folder.

For example, you want to display this new option as a text address to this property and it should be displayed directly above the Property Map section. So, you have to edit the file called property-map.php and right after the following line of code:

<div class="map-wrap clearfix">

add this:

<?php $address_of_property = get_post_meta($post->ID,'example_id',true); ?>
<span class="map-label">Property Address</span>
<div class="content clearfix">
    <p style="background: #f6f6f6; padding: 15px 0px 15px 15px; font-weight: 500;">
    <?php echo esc_html( $address_of_property ); ?></p>
</div>

After adding the above code you will have a new section like shown in the following screenshot.

If you still need further assistance or have a question then please feel free to open a ticket on our support site (login required):
https://support.inspirythemes.com/ask-question/