Realia WordPress Real Estate Theme Custom Amenities


/ Published in: Other
Save to your folder(s)

Adding a new custom amenity to the Theme Forest Realia WordPress real estate theme was tricky for me as I’m not ’.twig’ savvy. You can see my code and notes here where I show how I added an input box to capture a text string and a checkbox to indicate a sold property. I know the theme has ‘contract types’ but I couldn’t figure out how to use that to put a ‘sold badge’ onto a property.


Copy this code and paste it in your HTML
  1. /*
  2. Add new amenity to Realia WordPress real estate theme
  3. The idea is to follow the example to add your own custom amenity when the theme doesn't exactly support what you want.
  4. Disclaimer: I make no warranty as to the correctness of the coding; I'm not a '.twig' savvy guy. Any theme updates may break your edits so
  5. be sure to backup your work and make yourself some very descriptive notes.
  6.  
  7. File to edit and location - aviators/plugins/properties/meta.php
  8. */
  9.  
  10. /* Sold Checkbox - because I couldn't figure out how to get a sold badge to appear on a sold property using the sold contract item */
  11. <tr>
  12. <th>
  13. <label><?php echo __( 'Sold', 'aviators' ); ?></label>
  14. </th>
  15. <td>
  16. <?php $mb->the_field( 'sold' ); ?>
  17. <input type="checkbox" name="<?php $mb->the_name(); ?>" value="1" <?php checked( $mb->get_the_value() ); ?>/>
  18. </td>
  19. </tr>
  20.  
  21. /* Virtual Tour URL - because I wanted to popup an existing virtual tour in the built in Realia model window */
  22. <tr>
  23. <th>
  24. <label><?php echo __( 'Virtual Tour', 'aviators' ); ?></label>
  25. </th>
  26. <td>
  27. <?php $mb->the_field( 'virtualtour' ); ?>
  28. <input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>" /> Leave empty for no tour.
  29. </td>
  30. </tr>
  31.  
  32. /* ================================================================== */
  33.  
  34. /* Getting data to show on front end - Edit files and locations:
  35. /aviators/plugins/properties/templates/properties/property-box-small.twig (crazy url, I know! - This is the individual properties box in grid view where I show an icon if the property has a virtual tour.)
  36. */
  37. <div class="grid-v-tour">
  38. {% if property.meta._property_virtualtour.0 %}
  39. <img class="property-grid-vtour-image" src="{{ wp.get_stylesheet_directory_uri() }}/images/vTours.gif" width="75" />
  40. {% else %}
  41. <!-- No v tour url entered -->
  42. {% endif %}
  43. </div>
  44.  
  45. /* /aviators/plugins/properties/templates/properties/overview.twig (This is the 'Overview' box that shows on an individual property where I show a clickable icon to open my virtual tour url in a modal window.) */
  46. {% if wp.get_post_meta(post.ID, '_property_virtualtour') is empty %}
  47. <!-- No v-tour data entered -->
  48. {% else %}
  49. <tr>
  50. <td colspan="100%">
  51. <div class="grid-v-tour">
  52. <a class="virtualtour" href="{{wp.get_post_meta(post.ID, '_property_virtualtour').0 }}" title="Click for virtual tour (opens new window)">
  53. <img class="property-single-vtour-image" src="{{ wp.get_stylesheet_directory_uri() }}/images/vTours.gif" width="100" />
  54. </a>
  55. </div>
  56. </td>
  57. </tr>
  58. {% endif %}

URL: http://themeforest.net/item/realia-responsive-real-estate-wordpress-theme/4789838/comments?page=215

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.