Return to Snippet

Revision: 69397
at June 13, 2015 00:00 by FlashBuddy


Initial Code
/* 
    Add new amenity to Realia WordPress real estate theme
    The idea is to follow the example to add your own custom amenity when the theme doesn't exactly support what you want. 
    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
    be sure to backup your work and make yourself some very descriptive notes.
    
     File to edit and location - aviators/plugins/properties/meta.php 
 */
 
 /*     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  */
<tr>
	<th>
		<label><?php echo __( 'Sold', 'aviators' ); ?></label>
	</th>
	<td>
		<?php $mb->the_field( 'sold' ); ?>
		<input type="checkbox" name="<?php $mb->the_name(); ?>" value="1" <?php checked( $mb->get_the_value() ); ?>/>
	</td>
</tr>

/* Virtual Tour URL - because I wanted to popup an existing virtual tour in the built in Realia model window  */
<tr>
	<th>
		<label><?php echo __( 'Virtual Tour', 'aviators' ); ?></label>
	</th>
	<td>
		<?php $mb->the_field( 'virtualtour' ); ?>
		<input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>" /> Leave empty for no tour.
	</td>
</tr>

/* ================================================================== */

/*  Getting data to show on front end  - Edit files and locations:
     /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.)
*/
<div class="grid-v-tour">
    {% if property.meta._property_virtualtour.0 %}			
    <img class="property-grid-vtour-image" src="{{ wp.get_stylesheet_directory_uri() }}/images/vTours.gif" width="75" />
    {% else %}
    <!-- No v tour url entered -->
    {% endif %}
</div>

/*   /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.) */
 {% if wp.get_post_meta(post.ID, '_property_virtualtour') is empty %}
 <!-- No v-tour data entered -->
 {% else %}
<tr>
    <td colspan="100%">
	    <div class="grid-v-tour">
		    <a class="virtualtour" href="{{wp.get_post_meta(post.ID, '_property_virtualtour').0 }}" title="Click for virtual tour (opens new window)">
			    <img class="property-single-vtour-image" src="{{ wp.get_stylesheet_directory_uri() }}/images/vTours.gif" width="100" />
		    </a>
	    </div>
    </td>
</tr>				
{% endif %}

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

Initial Description
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.

Initial Title
Realia WordPress Real Estate Theme Custom Amenities

Initial Tags

                                

Initial Language
Other