Ejemplo n.º 1
0
function bsh_shortcode_customdata($args)
{
    global $post;
    $customdata = get_option('est_customdata');
    $defaults = array('key' => '', 'label' => false, 'raw' => false);
    $args = wp_parse_args($args, $defaults);
    extract($args);
    $key = '_est_meta_' . $key;
    $raw_value = get_post_meta(get_the_ID(), $key);
    $value = $raw == true ? $raw_value[0] : est_customdata_value($key, $raw_value);
    $output = $value;
    if ($label == 'true') {
        $output = $customdata[$key]['name'] . ': ' . $output;
    }
    return $output;
}
		</div>
		<div class='details'>
			<div class="info light">
			<?php 
$detail_1 = get_theme_mod('featured_properties_info_1');
$detail_1 = empty($detail_1) ? '_est_meta_building_area' : $detail_1;
$detail_2 = get_theme_mod('featured_properties_info_2');
$detail_2 = empty($detail_2) ? '_est_meta_property_area' : $detail_2;
$value = array();
if ($detail_1 != 'none') {
    $value[0] = get_post_meta(get_the_ID(), $detail_1);
    $value[0] = est_customdata_value($detail_1, $value[0]);
}
if ($detail_2 != 'none') {
    $value[1] = get_post_meta(get_the_ID(), $detail_2);
    $value[1] = est_customdata_value($detail_2, $value[1]);
}
if (!empty($value)) {
    echo implode(' - ', $value);
}
?>
			</div>
			<a class='button small' href='<?php 
the_permalink();
?>
'><?php 
_e('details', THEMENAME);
?>
</a>

		</div>
Ejemplo n.º 3
0
    }
    ksort($images);
    $imageCount = count($images);
}
?>

<?php 
if ($top_element != 'none') {
    ?>
	<div id='post-slider'>
		<?php 
    $detail = get_post_meta(get_the_ID(), '_est_ribbon_field', true);
    $detail = (empty($detail) or $detail == 'default') ? get_theme_mod('property_ribbon_field') : $detail;
    $detail = empty($detail) ? '_est_meta_price' : $detail;
    $value = get_post_meta(get_the_ID(), $detail);
    $value = est_customdata_value($detail, $value);
    if (!empty($value)) {
        ?>
			<div id='price-flag'><span class='price'><?php 
        echo $value;
        ?>
</span></div>
		<?php 
    }
    ?>
		<div id="property-slider" class="flexslider">
			<ul class="slides">
				<?php 
    foreach ($images as $image) {
        ?>
					<li>
Ejemplo n.º 4
0
function est_customdata_value($detail, $value, $args = array())
{
    $customdata = get_option('est_customdata');
    $detailvalue = '';
    if ($detail === 'location') {
        $location = array();
        $location_fields = array('_est_meta_country', '_est_meta_state', '_est_meta_city', '_est_meta_address', '_est_meta_zip_code');
        $used_fields = get_post_meta($args['post_id'], '_est_customdata', true);
        $used_location_fields = array();
        foreach ($used_fields as $key => $customdetail) {
            if (in_array($key, $location_fields) and !empty($customdetail['show'])) {
                $used_location_fields[] = $key;
            }
        }
        $details = get_post_meta($args['property_id']);
        if (in_array('_est_meta_country', $used_location_fields)) {
            if (!empty($details['_est_meta_country'])) {
                $location[] = est_customdata_value('_est_meta_country', $details['_est_meta_country'][0]);
            }
        }
        if (in_array('_est_meta_city', $used_location_fields)) {
            if (!empty($details['_est_meta_city'])) {
                $location[] = est_customdata_value('_est_meta_city', $details['_est_meta_city'][0]);
            }
        }
        if (in_array('_est_meta_state', $used_location_fields)) {
            if (!empty($details['_est_meta_state'])) {
                $location[] = est_customdata_value('_est_meta_state', $details['_est_meta_state'][0]);
            }
        }
        if (in_array('_est_meta_zip_code', $used_location_fields)) {
            if (!empty($details['_est_meta_zip_code'])) {
                $location[] = est_customdata_value('_est_meta_zip_code', $details['_est_meta_zip_code'][0]);
            }
        }
        if (in_array('_est_meta_address', $used_location_fields)) {
            if (!empty($details['_est_meta_address'])) {
                $location[] = est_customdata_value('_est_meta_address', $details['_est_meta_address'][0]);
            }
        }
        $location = implode(', ', $location);
        $detailvalue = '<span class="value">' . $location . '</span>';
    } else {
        if ($customdata[$detail]['type'] == 'text' and is_array($value)) {
            $value = $value[0];
        }
        if (is_array($value)) {
            $detailvalue = array();
            foreach ($value as $item) {
                $detailvalueelement = '';
                if (!empty($customdata[$detail]['prefix'])) {
                    $display = $customdata[$detail]['prefix'];
                    if (function_exists('icl_t')) {
                        $display = icl_t('Estatement - Custom Field Prefixes', $display, $display);
                    }
                    $prefix = '<span class="unit">' . $display . '</span>';
                }
                if (!empty($customdata[$detail]['options']) and is_array($customdata[$detail]['options'])) {
                    $name = $item;
                    foreach ($customdata[$detail]['options'] as $option) {
                        if ($option['value'] == $item) {
                            $name = $option['name'];
                        }
                    }
                    if (!empty($name)) {
                        $display = $name;
                        if (function_exists('icl_t')) {
                            $display = icl_t('Estatement - Custom Field Values', $display, $display);
                        }
                        $detailvalueelement = '<span class="value">' . $display . '</span>';
                    }
                } else {
                    $item = (!empty($customdata[$detail]['format']) and $customdata[$detail]['format'] == 'number') ? est_number_format($item, 2) : $item;
                    if (!empty($item)) {
                        $display = $item;
                        if (function_exists('icl_t')) {
                            $display = icl_t('Estatement - Custom Field Values', $display, $display);
                        }
                        $detailvalueelement = '<span class="value">' . $display . '</span>';
                    }
                }
                if (!empty($customdata[$detail]['suffix'])) {
                    $display = $customdata[$detail]['suffix'];
                    if (function_exists('icl_t')) {
                        $display = icl_t('Estatement - Custom Field Suffixes', $display, $display);
                    }
                    $suffix = '<span class="unit">' . $display . '</span>';
                }
                if (!empty($detailvalueelement)) {
                    $detailvalue[] = $prefix . $detailvalueelement . $suffix;
                }
            }
            $detailvalue = implode(', ', $detailvalue);
        } else {
            $value = (!empty($customdata[$detail]['format']) and $customdata[$detail]['format'] == 'number') ? est_number_format($value, 2) : $value;
            if (!empty($value)) {
                if (!empty($customdata[$detail]['prefix'])) {
                    $display = $customdata[$detail]['prefix'];
                    if (function_exists('icl_t')) {
                        $display = icl_t('Estatement - Custom Field Prefixes', $display, $display);
                    }
                    $detailvalue .= '<span class="unit">' . $display . '</span>';
                }
                $display = $value;
                if (function_exists('icl_t')) {
                    $display = icl_t('Estatement - Custom Field Suffixes', $display, $display);
                }
                $detailvalue .= '<span class="value">' . $display . '</span>';
                if (!empty($customdata[$detail]['suffix'])) {
                    $display = $customdata[$detail]['suffix'];
                    if (function_exists('icl_t')) {
                        $display = icl_t('Estatement - Custom Field Suffixes', $display, $display);
                    }
                    $detailvalue .= '<span class="unit">' . $display . '</span>';
                }
            }
        }
    }
    $value_class = '';
    if (!is_array($value[0])) {
        $value_class = str_replace('_est_meta_', '', $detail) . '-' . $value[0];
    }
    $detailvalue = ($detailvalue == '<span class="value"></span>' or $detailvalue == '') ? '' : $detailvalue;
    if (!empty($detailvalue)) {
        return '<span class="est_value ' . $value_class . '">' . $detailvalue . '</span>';
    }
}