Custom Post type with taxonomy and metabox

Functions.php


function realestate_custom_posttype()
{

/* To add CPT Listings*/
$realestate_listings_labels = array(
'name' => 'Listings',
'singular_name' => 'listing',
'add_new' => 'Add New',
'add_new_item' => 'Add New',
'edit_item' => 'Edit Listing',
'new_item' => 'New Listing',
'all_items' => 'Listings',
'view_item' => 'View Listing',
'search_items' => 'Search Listing',
'not_found' => 'No Listing found',
'not_found_in_trash' => 'No Listing found in Trash',
'parent_item_colon' => '',
'menu_name' => 'Listings'
);

$realestate_listings_args = array(
'labels' => $realestate_listings_labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'menu_icon' => get_template_directory_uri(). '/images/listing_icon.png',
'rewrite' => array( 'slug' => 'listing' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor','thumbnail'),
'taxonomies' => array( 'features')
);

register_post_type( 'listing', $realestate_listings_args );

$realestate_feature_labels = array(
'name' => _x( 'Features', 'taxonomy general name' ),
'singular_name' => _x( 'Feature', 'taxonomy singular name' ),
'search_items' => __( 'Search Features' ),
'all_items' => __( 'All Features' ),
'parent_item' => __( 'Parent Features' ),
'parent_item_colon' => __( 'Parent Features:' ),
'edit_item' => __( 'Edit Feature' ),
'update_item' => __( 'Update Feature' ),
'add_new_item' => __( 'Add New Feature' ),
'new_item_name' => __( 'New Feature' ),
'menu_name' => __( 'Features' ),
);

$realestate_feature_args = array(
'hierarchical' => false,
'labels' => $realestate_feature_labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
'rewrite' => array( 'slug' => 'features' ),
);
register_taxonomy( 'features', array( 'listing' ), $realestate_feature_args );
}
add_action( 'init', 'realestate_custom_posttype' );
function listing_meta_box(){
add_meta_box('property_info', __( 'Property Details', 'realestate' ), 'property_info', 'listing', 'normal', 'low');
add_meta_box('attachments_info',__( 'Extra Image', 'realestate' ), 'attachments_info', 'listing', 'normal', 'low');
add_meta_box('contact_info',__( 'Contact Information', 'realestate' ), 'contact_info', 'listing', 'normal', 'low');
add_meta_box('featured_info',__( 'Featured Property', 'realestate' ), 'featured_info', 'listing', 'side', 'low');
}
add_action("add_meta_boxes", "listing_meta_box");

function featured_info(){
global $post;
$realestate_featured = get_post_meta($post->ID,'featured',true)?get_post_meta($post->ID,'featured',true):'';
$realestate_checked='';
if($realestate_featured != '')
$realestate_checked='checked';
?>
<table class="form-table">
<tr>
<td><label for="featured"><b><?php _e('Featured','realestate'); ?>:</b></label>
<input type="checkbox" name="featured" value="Y" <?php echo $realestate_checked; ?> class="listing_input" /></td>
</tr>
</table>
<?php

}
function property_info() {

global $post;
$realestate_property_type = get_post_meta($post->ID,'property_type',true)?get_post_meta($post->ID,'property_type',true):'';
$realestate_list_type = get_post_meta($post->ID,'list_type',true)?get_post_meta($post->ID,'list_type',true):'';
$realestate_duration = get_post_meta($post->ID,'duration',true)?get_post_meta($post->ID,'duration',true):'';
$realestate_rooms = get_post_meta($post->ID,'rooms',true)?get_post_meta($post->ID,'rooms',true):'';
$realestate_sq_ft = get_post_meta($post->ID,'sq_ft',true)?get_post_meta($post->ID,'sq_ft',true):'';
$realestate_price = get_post_meta($post->ID,'price',true)?get_post_meta($post->ID,'price',true):'0';
$realestate_rooms = get_post_meta($post->ID,'rooms',true)?get_post_meta($post->ID,'rooms',true):'';
$realestate_bedroom = get_post_meta($post->ID,'bedroom',true)?get_post_meta($post->ID,'bedroom',true):'';
$realestate_bathroom = get_post_meta($post->ID,'bathroom',true)?get_post_meta($post->ID,'bathroom',true):'';
$realestate_address = get_post_meta($post->ID,'address',true)?get_post_meta($post->ID,'address',true):'';
?>

<table class="form-table">
<tr>
<th><label for="property_type">
<?php _e('Property Type','realestate'); ?>
</label></th>

<td>
<select id="property_type" name="property_type" class="listing_input">
<option value="Apartment" <?php if($realestate_property_type == "Apartment"){?> selected="selected"<?php } ?>>Apartment</option>
<option value="House" <?php if($realestate_property_type == "House"){?> selected="selected"<?php } ?>>House</option>
<option value="Office" <?php if($realestate_property_type == "Office"){?> selected="selected"<?php } ?>>Office</option>
<option value="Villa" <?php if($realestate_property_type == "Villa"){?> selected="selected"<?php } ?>>Villa</option>
</select>
</td>
</tr>
<tr>
<th><label for="list_type">
<?php _e('Listing Type','realestate'); ?>
</label></th>
<td><select id="list_type" name="list_type" class="listing_input change_listtype">
<option value="rent" <?php if($realestate_list_type == "rent"){?> selected="selected"<?php } ?>>For Rent</option>
<option value="sale" <?php if($realestate_list_type == "sale"){?> selected="selected"<?php } ?>>For Sale</option>
</select></td>
</tr>
<tr>
<th><label for="sq_ft">
<?php _e('Square Feet','realestate'); ?>
</label></th>
<td><input type="number" name="sq_ft" value="<?php echo $realestate_sq_ft; ?>" min="0" step="any" class="listing_input" /></td>
</tr>
<tr id="duration-tr" class="hide-duration">
<th><label for="duration">
<?php _e('Duration','realestate'); ?>
</label></th>
<td><select id="duration" name="duration" class="listing_input">
<option value="week" <?php if($realestate_duration == "week"){?> selected="selected"<?php } ?>>Weekly</option>
<option value="month" <?php if($realestate_duration == "month"){?> selected="selected"<?php } ?>>Monthly</option>
<option value="year" <?php if($realestate_duration == "year"){?> selected="selected"<?php } ?>>yearly</option>
</select></td>
</tr>
<tr>
<th><label for="price">
<?php _e('Price','realestate'); ?>
</label></th>
<td><input type="number" name="price" value="<?php echo $realestate_price; ?>" min="0" step="any" class="listing_input" /></td>
</tr>
<tr>
<th><label for="rooms">
<?php _e('Rooms','realestate'); ?>
</label></th>
<td><input type="text" name="rooms" value="<?php echo $realestate_rooms; ?>" class="listing_input" /></td>
</tr>

<tr>
<th><label for="bedroom">
<?php _e('Bedrooms','realestate'); ?>
</label></th>
<td><input type="number" name="bedroom" value="<?php echo $realestate_bedroom; ?>" min=="0" class="listing_input" /></td>
</tr>
<tr>
<th><label for="bathroom">
<?php _e('Bathrooms','realestate'); ?>
</label></th>
<td><input type="number" name="bathroom" value="<?php echo $realestate_bathroom; ?>" min="0" class="listing_input" /></td>
</tr>
<tr>
<th><label for="address">
<?php _e('Address','realestate'); ?>
</label></th>
<td><textarea name="address" class="listing_input" /><?php echo $realestate_address; ?></textarea></td>
</tr>
</table>
<?php
}
function attachments_info(){
global $post;
$realestate_image1 = get_post_meta($post->ID,'image1',true)?get_post_meta($post->ID,'image1',true):'';
$realestate_image2 = get_post_meta($post->ID,'image2',true)?get_post_meta($post->ID,'image2',true):'';
$realestate_image3 = get_post_meta($post->ID,'image3',true)?get_post_meta($post->ID,'image3',true):'';
?>
<table class="form-table">
<tr>
<th><label for="image1">
<?php _e('Image 1 ','realestate'); ?>
</label></th>
<td><div class="section section-upload ">
<input id="image1" class="upload listing_input_upload" type="text" name="image1" value="<?php echo $realestate_image1; ?>" placeholder="No file chosen" />
<input id="upload_image_button" class="upload-button button" type="button" value="Upload" />
<div class="screenshot" id="logo-image">
<?php if(!empty($realestate_image1)){
echo "<a href='".$realestate_image1."' target='_blank'><img src='".$realestate_image1."' /></a><a class='remove-image'>Remove</a>" ;
}
?>
</div>
</div></td>
</tr>

<tr>
<th><label for="image2">
<?php _e('Image 2 ','realestate'); ?>
</label></th>
<td><div class="section section-upload ">
<input id="image2" class="upload listing_input_upload" type="text" name="image2" value="<?php echo $realestate_image2; ?>" placeholder="No file chosen" />
<input id="upload_image_button" class="upload-button button" type="button" value="Upload" />
<div class="screenshot" id="logo-image">
<?php if(!empty($realestate_image2)){
echo "<a href='".$realestate_image2."' target='_blank'><img src='".$realestate_image2."' /></a><a class='remove-image'>Remove</a>" ;
}
?>
</div>
</div></td>
</tr>

<tr>
<th><label for="image3">
<?php _e('Image 3 ','realestate'); ?>
</label></th>
<td><div class="section section-upload ">
<input id="image3" class="upload listing_input_upload" type="text" name="image3" value="<?php echo $realestate_image3; ?>" placeholder="No file chosen" />
<input id="upload_image_button" class="upload-button button" type="button" value="Upload" />
<div class="screenshot" id="logo-image">
<?php if(!empty($realestate_image3)){
echo "<a href='".$realestate_image3."' target='_blank'><img src='".$realestate_image3."' /></a><a class='remove-image'>Remove</a>" ;
}
?>
</div>
</div></td>
</tr>

</table>
<?php

}
function contact_info() {

global $post;
$realestate_name = get_post_meta($post->ID,'name',true)?get_post_meta($post->ID,'name',true):'';
$realestate_email = get_post_meta($post->ID,'email',true)?get_post_meta($post->ID,'email',true):'';
$realestate_phone = get_post_meta($post->ID,'phone',true)?get_post_meta($post->ID,'phone',true):'';
$realestate_mobile= get_post_meta($post->ID,'mobile',true)?get_post_meta($post->ID,'mobile',true):'';
$realestate_fax= get_post_meta($post->ID,'fax',true)?get_post_meta($post->ID,'fax',true):'';
?>

<table class="form-table">
<tr>
<th><label for="name">
<?php _e('Contact Name','realestate'); ?>
</label></th>
<td><input type="text" name="name" value="<?php echo $realestate_name; ?>" class="listing_input" /></td>
</tr>

<tr>
<th><label for="email">
<?php _e('Contact Email','realestate'); ?>
</label></th>
<td><input type="text" name="email" value="<?php echo $realestate_email; ?>" class="listing_input" /></td>
</tr>
<tr>
<th><label for="phone">
<?php _e('Contact Phone','realestate'); ?>
</label></th>
<td><input type="text" name="phone" value="<?php echo $realestate_phone; ?>" class="listing_input" /></td>
</tr>
<tr>
<th><label for="mobile">
<?php _e('Contact Mobile','realestate'); ?>
</label></th>
<td><input type="text" name="mobile" value="<?php echo $realestate_mobile; ?>" class="listing_input" /></td>
</tr>
<tr>
<th><label for="fax">
<?php _e('Contact Fax','realestate'); ?>
</label></th>
<td><input type="text" name="fax" value="<?php echo $realestate_fax; ?>" class="listing_input" /></td>
</tr>

</table>
<?php
}
add_action('save_post', 'realestate_property_save_details');
function realestate_property_save_details(){
global $post;
if(!empty($_POST))
{
//featured_info
update_post_meta($post->ID, "featured", $_POST["featured"]);
//Property Details:
update_post_meta($post->ID, "property_type", $_POST["property_type"]);
update_post_meta($post->ID, "list_type", $_POST["list_type"]);
update_post_meta($post->ID, "duration", $_POST["duration"]);
update_post_meta($post->ID, "sq_ft", $_POST["sq_ft"]);
update_post_meta($post->ID, "price", filter_var($_POST["price"],FILTER_SANITIZE_NUMBER_FLOAT));
update_post_meta($post->ID, "rooms", filter_var($_POST["rooms"],FILTER_SANITIZE_NUMBER_FLOAT));
update_post_meta($post->ID, "bedroom", filter_var($_POST["bedroom"],FILTER_SANITIZE_NUMBER_FLOAT));
update_post_meta($post->ID, "bathroom", filter_var($_POST["bathroom"],FILTER_SANITIZE_NUMBER_FLOAT));
update_post_meta($post->ID, "address", $_POST["address"]);
//address details
update_post_meta($post->ID, "floorno", $_POST["floorno"]);
update_post_meta($post->ID, "b_name", $_POST["b_name"]);
update_post_meta($post->ID, "street", $_POST["street"]);
update_post_meta($post->ID, "zipcode", $_POST["zipcode"]);
update_post_meta($post->ID, "city", $_POST["city"]);
update_post_meta($post->ID, "county", $_POST["county"]);
update_post_meta($post->ID, "state", $_POST["state"]);
update_post_meta($post->ID, "country", $_POST["country"]);

//contact info
update_post_meta($post->ID, "disp_contact", $_POST["disp_contact"]);
update_post_meta($post->ID, "name", $_POST["name"]);
update_post_meta($post->ID, "email",sanitize_email($_POST['email']));
update_post_meta($post->ID, "phone", $_POST["phone"]);
update_post_meta($post->ID, "mobile", $_POST["mobile"]);
update_post_meta($post->ID, "fax", $_POST["fax"]);

//attachments
update_post_meta($post->ID, "image1", $_POST["image1"]);
update_post_meta($post->ID, "image2", $_POST["image2"]);
update_post_meta($post->ID, "image3", $_POST["image3"]);
}
}

 

JS file for Uploading Image


(function($) {
$(document).ready(function() {

function realestate_add_file(event, selector) {

var upload = $(".uploaded-file"), frame;
var $el = $(this);

event.preventDefault();

// If the media frame already exists, reopen it.
if ( frame ) {
frame.open();
return;
}

// Create the media frame.
frame = wp.media({
// Set the title of the modal.
title: $el.data('choose'),

// Customize the submit button.
button: {
// Set the text of the button.
text: $el.data('update'),
// Tell the button not to close the modal, since we're
// going to refresh the page when the image is selected.
close: false
}
});

// When an image is selected, run a callback.
frame.on( 'select', function() {
// Grab the selected attachment.
var attachment = frame.state().get('selection').first();
frame.close();
selector.find('.upload').val(attachment.attributes.url);
if ( attachment.attributes.type == 'image' ) {
selector.find('.screenshot').empty().hide().append('<img src="' + attachment.attributes.url + '"><a class="remove-image"></a>').slideDown('fast');
}
selector.find('.upload-button').unbind().addClass('remove-file').removeClass('upload-button');
selector.find('.of-background-properties').slideDown();
selector.find('.remove-image, .remove-file').on('click', function() {
realestate_remove_file( $(this).parents('.section') );
});
});

// Finally, open the modal.
frame.open();
}

function realestate_remove_file(selector) {
selector.find('.remove-image').hide();
selector.find('.upload').val('');
selector.find('.of-background-properties').hide();
selector.find('.screenshot').slideUp();
selector.find('.remove-file').unbind().addClass('upload-button').removeClass('remove-file');
// We don't display the upload button if .upload-notice is present
// This means the user doesn't have the WordPress 3.5 Media Library Support
if ( $('.section-upload .upload-notice').length > 0 ) {
$('.upload-button').remove();
}
selector.find('.upload-button').live('click', function() {
realestate_add_file(event, $(this).parents('.section'));
});
}

$('.remove-image, .remove-file').live('click', function() {
realestate_remove_file( $(this).parents('.section') );
});

$('.upload-button').live('click', function( event ) {
realestate_add_file(event, $(this).parents('.section'));
});

});
/*for custom post type media upload*/
if(jQuery('#list_type').val() == 'rent')
jQuery('#duration-tr').removeClass( "hide-duration");
jQuery(".change_listtype").change(function($)
{
if(jQuery('#list_type').val() == 'rent')
jQuery('#duration-tr').removeClass( "hide-duration");
else
jQuery('#duration-tr').addClass( "hide-duration");

});
/*end*/

})(jQuery);

CSS Style and also  add remove image in images folder

<

div class=”cssRule cssEditableRule insertInto editGroup “>

</div>
<div class="cssHead focusRow "><span class="cssSelector editable ">.screenshot .remove-image</span> {</div>
<div class=" ">
<div class="cssPropertyListBox ">
<div class="cssProp focusRow editGroup "><span class="cssPropIndent ">    </span><span class="cssPropName editable ">background</span><span class="cssColon ">: </span><span class="cssPropValue editable ">rgba(0, 0, 0, 0) url("../images/ico-delete.png") no-repeat scroll 0 0</span><span class="cssSemi ">;</span></div>
<div class="cssProp focusRow editGroup "><span class="cssPropIndent ">    </span><span class="cssPropName editable ">border</span><span class="cssColon ">: </span><span class="cssPropValue editable ">medium none</span><span class="cssSemi ">;</span></div>
<div class="cssProp focusRow editGroup "><span class="cssPropIndent ">    </span><span class="cssPropName editable ">bottom</span><span class="cssColon ">: </span><span class="cssPropValue editable ">4px</span><span class="cssSemi ">;</span></div>
<div class="cssProp focusRow editGroup "><span class="cssPropIndent ">    </span><span class="cssPropName editable ">display</span><span class="cssColon ">: </span><span class="cssPropValue editable ">block</span><span class="cssSemi ">;</span></div>
<div class="cssProp focusRow editGroup "><span class="cssPropIndent ">    </span><span class="cssPropName editable ">float</span><span class="cssColon ">: </span><span class="cssPropValue editable ">left</span><span class="cssSemi ">;</span></div>
<div class="cssProp focusRow editGroup "><span class="cssPropIndent ">    </span><span class="cssPropName editable ">height</span><span class="cssColon ">: </span><span class="cssPropValue editable ">16px</span><span class="cssSemi ">;</span></div>
<div class="cssProp focusRow editGroup "><span class="cssPropIndent ">    </span><span class="cssPropName editable ">padding</span><span class="cssColon ">: </span><span class="cssPropValue editable ">0</span><span class="cssSemi ">;</span></div>
<div class="cssProp focusRow editGroup "><span class="cssPropIndent ">    </span><span class="cssPropName editable ">position</span><span class="cssColon ">: </span><span class="cssPropValue editable ">absolute</span><span class="cssSemi ">;</span></div>
<div class="cssProp focusRow editGroup "><span class="cssPropIndent ">    </span><span class="cssPropName editable ">right</span><span class="cssColon ">: </span><span class="cssPropValue editable ">-4px</span><span class="cssSemi ">;</span></div>
<div class="cssProp focusRow editGroup "><span class="cssPropIndent ">    </span><span class="cssPropName editable ">text-indent</span><span class="cssColon ">: </span><span class="cssPropValue editable ">-9999px</span><span class="cssSemi ">;</span></div>
<div class="cssProp focusRow editGroup "><span class="cssPropIndent ">    </span><span class="cssPropName editable ">width</span><span class="cssColon ">: </span><span class="cssPropValue editable ">16px</span><span class="cssSemi ">;</span></div>
</div>
</div>
<div class=" editable insertBefore ">}</div>
</div>
<div class=" editable insertBefore "> 
Display Posts in Page Template
</div>
<div class=" editable insertBefore "><?php
/*
Template Name:Property Page
*/
?>
<?php
get_header();
?>
<section>
<div class="breadcumb-bg">
<div class="webpage-container container">
<div class="site-breadcumb">
<h1><?php _e('Property', 'realestate'); ?></h1>
<ol class="breadcrumb breadcrumb-menubar">
<?php if (function_exists('realestate_custom_breadcrumbs')) realestate_custom_breadcrumbs(); ?>
</ol>
</div>
</div>
</div>
<?php
$property_array = $list_array = $room_array = $realestate_bathrooms_array = $realestate_bedrooms_array = $realestate_from_array = $realestate_to_array = '';
$realestate_from = $realestate_to = $realestate_price = $realestate_bathrooms = $realestate_bedrooms = $realestate_rooms = '';if (isset($_REQUEST)) {
$realestate_property_type = $_REQUEST['property_type'];
$realestate_list_type = $_REQUEST['list_type'];
$realestate_rooms = $_REQUEST['rooms'];
$realestate_bathrooms = $_REQUEST['bathrooms'];
$realestate_bedrooms = $_REQUEST['bedrooms'];
$realestate_myprice = $_REQUEST['myamount'];
$realestate_features_request = $_REQUEST['feature'];
if (!empty($realestate_features_request)) {
$realestate_features = implode(",", $realestate_features_request);
$realestate_features_array = array(
'taxonomy' => 'features',
'field' => 'id',
'terms' => $realestate_features,
'operator' => 'AND'
);
}
if ($realestate_myprice != '') {
$realestate_price = explode("-", $realestate_myprice);
$realestate_from = $realestate_price[0];
$realestate_to = $realestate_price[1];
}
if ($realestate_property_type != '') {
$property_array = array(
'key' => 'property_type',
'value' => $realestate_property_type,
);
}
if ($realestate_list_type != '') {
$list_array = array(
'key' => 'list_type',
'value' => $realestate_list_type,
);
}
if ($realestate_rooms != 0) {
if ($realestate_rooms == 5) {
$room_array = array(
'key' => 'rooms',
'value' => $realestate_rooms,
'type' => 'numeric',
'compare' => '>=',
);
} else {
$room_array = array(
'key' => 'rooms',
'value' => $realestate_rooms,
);
}
}
if ($realestate_bathrooms != 0) {
if ($realestate_bathrooms == 5) {
$realestate_bathrooms_array = array(
'key' => 'bathroom',
'value' => $realestate_bathrooms,
'type' => 'numeric',
'compare' => '>=',
);
} else {
$realestate_bathrooms_array = array(
'key' => 'bathroom',
'value' => $realestate_bathrooms,
);
}
}
if ($realestate_bedrooms != 0) {
if ($realestate_bedrooms == 5) {
$realestate_bedrooms_array = array(
'key' => 'bedroom',
'value' => $realestate_bedrooms,
'type' => 'numeric',
'compare' => '>=',
);
} else {
$realestate_bedrooms_array = array(
'key' => 'bedroom',
'value' => $realestate_bedrooms,
);
}
}
if (!empty($realestate_myprice)) {
$realestate_from_array = array(
'key' => 'price',
'value' => $realestate_from,
'type' => 'numeric',
'compare' => '>=',
);
}
if (!empty($realestate_myprice)) {
$realestate_to_array = array(
'key' => 'price',
'value' => $realestate_to,
'type' => 'numeric',
'compare' => '<=',
);
}
}
?>

<?php
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$realestate_args = array(
'paged' => $paged,
'post_type' => 'listing',
'post_status' => 'publish',
'meta_query' => array(
'relation' => 'AND',
$property_array, $list_array, $room_array, $realestate_bathrooms_array, $realestate_bedrooms_array, $realestate_from_array, $realestate_to_array),
'tax_query' => array(
'relation' => 'AND',
$realestate_features_array)
);
$realestate_arrays1 = new WP_Query($realestate_args);
?>
<div class="webpage-container">
<div class="property-blog-page">
<div class="recent-listings">

<?php while ($realestate_arrays1->have_posts()) : $realestate_arrays1->the_post(); ?>
<?php
$realestate_property_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'realestate-property-tab-size');
if (empty($realestate_property_image)) {
for ($realestate_i = 1; $realestate_i <= 3; $realestate_i++) {
$realestate_key = 'image' . $realestate_i;
$realestate_image = get_post_meta(get_the_ID(), $realestate_key, true);
if (!empty($realestate_image)) {
$realestate_image_id = realestate_get_image_id($realestate_image);
$realestate_property_image = wp_get_attachment_image_src($realestate_image_id, 'realestate-property-tab-size');
break;
}
}
}
if (!empty($realestate_property_image)) {
?>
<div class="col-md-4 col-sm-6 blog-post blog-post">
<div class="col-md-12 no-padding-lr listing-details">

<a href="<?php the_permalink(); ?>"><img src="<?php echo $realestate_property_image[0]; ?>" width="<?php echo $realestate_property_image[1]; ?>" height="<?php echo $realestate_property_image[2]; ?>" alt="<?php the_title(); ?>"></a>
<div class="property-details">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<ul>
<?php $realestate_sqft = get_post_meta(get_the_ID(), 'sq_ft', true);
if (!empty($realestate_sqft)) {
?>
<li><?php echo $realestate_sqft; ?> <?php _e('Sq Ft', 'realestate'); ?></li>
<?php } ?>
<?php $realestate_bathrooms = get_post_meta(get_the_ID(), 'bathroom', true);
if (!empty($realestate_bathrooms)) {
?>
<li><?php echo $realestate_bathrooms; ?> <?php _e('Bathrooms', 'realestate'); ?></li>
<?php } ?>
<?php $realestate_bedrooms = get_post_meta(get_the_ID(), 'bedroom', true);
if (!empty($realestate_bedrooms)) {
?>
<li><?php echo $realestate_bedrooms; ?> <?php _e('Bedrooms', 'realestate'); ?></li>
<?php } ?>
</ul>
<?php
$realestate_price = get_post_meta(get_the_ID(), 'price', true);
if (!empty($realestate_price)) {
?>
<a href="<?php the_permalink(); ?>" class="ref-link">$<?php echo $realestate_price ?></a>
<?php } ?>

<a href="<?php the_permalink(); ?>" class="ref-link"><?php _e('Details', 'realestate'); ?></a>
</div>
</div>
</div>
<?php } ?>

<?php endwhile; ?>
<div class="col-md-12 no-padding-lr">
<div class="pagination">
<?php realestate_custom_pagination($realestate_arrays1->max_num_pages, '2'); ?>
</div>
</div>
</div>
</div>
</div>
</section>
<?php get_footer(); ?>

Advertisements

Tagged:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: