| 1 |
<?php |
| 2 |
/** |
| 3 |
* The template for Result Item. |
| 4 |
* |
| 5 |
* This is the template that for result listing of listings preview |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly. |
| 11 |
} |
| 12 |
?> |
| 13 |
|
| 14 |
<?php |
| 15 |
$layout_type = 'grid'; |
| 16 |
|
| 17 |
if(isset($settings['layout_type'])) { |
| 18 |
$layout_type = $settings['layout_type']; |
| 19 |
} |
| 20 |
|
| 21 |
$content_button_icon = '<span class="dashicons dashicons-edit"></span>'; |
| 22 |
if(isset($settings['content_button_icon'])) { |
| 23 |
$content_button_icon = $settings['content_button_icon']; |
| 24 |
} |
| 25 |
|
| 26 |
$url = '#'; |
| 27 |
|
| 28 |
if(!wmvc_user_in_role('administrator') && !current_user_can('wdk_listings_manage')) { |
| 29 |
if(function_exists('wdk_dash_url') && wdk_dash_url('dash_page=listings&function=edit') && current_user_can('edit_own_listings') && wdk_field_value('user_edit_listing', $listing)) { |
| 30 |
$url = esc_url(wdk_dash_url('dash_page=listings&function=edit&id=' . wdk_field_value('post_id', $listing))); |
| 31 |
} |
| 32 |
} else{ |
| 33 |
$url = esc_url(admin_url('admin.php?page=wdk_listing&id='.wdk_field_value('post_id', $listing))); |
| 34 |
} |
| 35 |
|
| 36 |
$url_preview = get_permalink($listing); |
| 37 |
|
| 38 |
$title_part = wdk_resultitem_fields_section_value(1, 2, $listing); |
| 39 |
$subtitle_part = wdk_resultitem_fields_section_value(1, 3, $listing); |
| 40 |
$over_image_bottom = wdk_resultitem_fields_section_value(1, 1, $listing); |
| 41 |
$over_image_top = wdk_resultitem_fields_section_value(1, 0, $listing); |
| 42 |
$features_part = wdk_resultitem_fields_section_value(1, 4, $listing); |
| 43 |
$price_part = wdk_resultitem_fields_section_value(1, 5, $listing); |
| 44 |
$resul_item_config = wdk_resultitem(); |
| 45 |
?> |
| 46 |
<div class="wdk-listing-card <?php echo esc_attr($layout_type);?> <?php if(wdk_get_option('wdk_is_featured_enabled', FALSE) && wmvc_show_data('is_featured', $listing, '') == 1):?> is_featured <?php endif;?> <?php if(wmvc_show_data('is_multiline_enabled', $resul_item_config, '') == 1):?> is_multiline_enabled <?php endif;?>"> |
| 47 |
<div class="wdk-thumbnail"> |
| 48 |
<img src="<?php echo esc_url(wdk_image_src($listing, 'full'));?>" alt="<?php echo esc_attr(wmvc_show_data('post_title', $listing)) ;?>" class="wdk-image"> |
| 49 |
<a href="<?php echo esc_url($url_preview);?>" target="_blank" class="wdk-thumbnail_link" title="<?php echo esc_attr(wmvc_show_data('post_title', $listing)) ;?>"></a> |
| 50 |
<?php if(!empty($over_image_top)):?> |
| 51 |
<div class="wdk-over-image-top"> |
| 52 |
<?php foreach ($over_image_top as $key => $field):?> |
| 53 |
<span> |
| 54 |
<?php |
| 55 |
echo esc_html(strip_tags(apply_filters( 'wpdirectorykit/listing/field/prefix', wmvc_show_data('prefix', $field), wmvc_show_data('field_id', $field)))) |
| 56 |
.esc_html(strip_tags(apply_filters( 'wpdirectorykit/listing/field/value', wdk_filter_decimal(wmvc_show_data('value', $field)), wmvc_show_data('field_id', $field)))) |
| 57 |
.esc_html(strip_tags(apply_filters( 'wpdirectorykit/listing/field/suffix', wmvc_show_data('suffix', $field), wmvc_show_data('field_id', $field)))); |
| 58 |
?> |
| 59 |
</span> |
| 60 |
<?php endforeach;?> |
| 61 |
</div> |
| 62 |
<?php endif;?> |
| 63 |
<?php if(!empty($over_image_bottom) || function_exists('run_wdk_favorites')):?> |
| 64 |
<div class="wdk-over-image-bottom"> |
| 65 |
<?php if(!empty($over_image_bottom)) foreach ($over_image_bottom as $key => $field):?> |
| 66 |
<span class='wdk-item'> |
| 67 |
<?php |
| 68 |
echo esc_html(strip_tags(apply_filters( 'wpdirectorykit/listing/field/prefix', wmvc_show_data('prefix', $field), wmvc_show_data('field_id', $field)))) |
| 69 |
.esc_html(strip_tags(apply_filters( 'wpdirectorykit/listing/field/value', wdk_filter_decimal(wmvc_show_data('value', $field)), wmvc_show_data('field_id', $field)))) |
| 70 |
.esc_html(strip_tags(apply_filters( 'wpdirectorykit/listing/field/suffix', wmvc_show_data('suffix', $field), wmvc_show_data('field_id', $field)))); |
| 71 |
?> |
| 72 |
</span> |
| 73 |
<?php endforeach;?> |
| 74 |
</div> |
| 75 |
<?php endif;?> |
| 76 |
<div class="overlay"></div> |
| 77 |
</div> |
| 78 |
<?php if($layout_type == 'list'):?> |
| 79 |
<div class="wdk-content"> |
| 80 |
<?php endif;?> |
| 81 |
<?php if(!empty($title_part)):?> |
| 82 |
<div class="wdk-title"> |
| 83 |
<h2 class="title"> |
| 84 |
<a href="<?php echo esc_url($url_preview);?>" target="_blank" title="<?php echo esc_attr(wmvc_show_data('post_title', $listing)) ;?>"> |
| 85 |
<?php foreach ($title_part as $key => $field):?> |
| 86 |
<span> |
| 87 |
<?php |
| 88 |
echo esc_html(apply_filters( 'wpdirectorykit/listing/field/prefix', wmvc_show_data('prefix', $field), wmvc_show_data('field_id', $field))) |
| 89 |
.esc_html(strip_tags(apply_filters( 'wpdirectorykit/listing/field/value', wdk_filter_decimal(wmvc_show_data('value', $field)), wmvc_show_data('field_id', $field)))) |
| 90 |
.esc_html(apply_filters( 'wpdirectorykit/listing/field/suffix', wmvc_show_data('suffix', $field), wmvc_show_data('field_id', $field))); |
| 91 |
?> |
| 92 |
</span> |
| 93 |
<?php endforeach;?> |
| 94 |
</a> |
| 95 |
</h2> |
| 96 |
</div> |
| 97 |
<?php endif;?> |
| 98 |
<?php if(!empty($subtitle_part)):?> |
| 99 |
<div class="wdk-subtitle-part"> |
| 100 |
<?php foreach ($subtitle_part as $key => $field):?> |
| 101 |
<span> |
| 102 |
<?php |
| 103 |
echo esc_html(apply_filters( 'wpdirectorykit/listing/field/prefix', wmvc_show_data('prefix', $field), wmvc_show_data('field_id', $field))) |
| 104 |
.esc_html(strip_tags(apply_filters( 'wpdirectorykit/listing/field/value', wdk_filter_decimal(wmvc_show_data('value', $field)), wmvc_show_data('field_id', $field)))) |
| 105 |
.esc_html(apply_filters( 'wpdirectorykit/listing/field/suffix', wmvc_show_data('suffix', $field), wmvc_show_data('field_id', $field))); |
| 106 |
?> |
| 107 |
</span> |
| 108 |
<?php endforeach;?> |
| 109 |
</div> |
| 110 |
<?php endif;?> |
| 111 |
<?php if(!empty($features_part)):?> |
| 112 |
<div class="wdk-features-part"> |
| 113 |
<?php foreach ($features_part as $key => $field):?><?php if(wmvc_show_data('field_type', $field) == 'CHECKBOX'):?> |
| 114 |
<span><?php echo esc_html(esc_html(wmvc_show_data('field_label', $field, '')));?></span> |
| 115 |
<?php else:?> |
| 116 |
<?php if(!wdk_filter_decimal(wmvc_show_data('value', $field))) continue;?> |
| 117 |
<span> |
| 118 |
<?php if(wmvc_show_data('icon_id', $field, false)):?> |
| 119 |
<img src="<?php echo esc_url(wdk_image_src($field, 'full',NULL,'icon_id'));?>" alt="<?php echo esc_attr(esc_html(wmvc_show_data('field_label', $field, '')));?>" class="wdk-icon"> |
| 120 |
<?php endif;?> |
| 121 |
|
| 122 |
<?php if(wmvc_show_data('is_label_disable', $resul_item_config, false) != 1):?> |
| 123 |
<?php echo esc_html(esc_html(wmvc_show_data('field_label', $field, '')));?>: |
| 124 |
<?php endif;?> |
| 125 |
|
| 126 |
<?php |
| 127 |
echo esc_html(apply_filters( 'wpdirectorykit/listing/field/prefix', wmvc_show_data('prefix', $field), wmvc_show_data('field_id', $field))) |
| 128 |
.esc_html(strip_tags(apply_filters( 'wpdirectorykit/listing/field/value', wdk_filter_decimal(wmvc_show_data('value', $field)), wmvc_show_data('field_id', $field)))) |
| 129 |
.esc_html(apply_filters( 'wpdirectorykit/listing/field/suffix', wmvc_show_data('suffix', $field), wmvc_show_data('field_id', $field))); |
| 130 |
?> |
| 131 |
</span> |
| 132 |
<?php endif;?> |
| 133 |
<?php endforeach;?> |
| 134 |
</div> |
| 135 |
<?php endif;?> |
| 136 |
<div class="wdk-divider"></div> |
| 137 |
<div class="wdk-footer"> |
| 138 |
<div class="wdk-left"> |
| 139 |
<div class="wdk-price"> |
| 140 |
<?php if(!empty($price_part)):?> |
| 141 |
<?php foreach ($price_part as $key => $field):?> |
| 142 |
<span> |
| 143 |
<?php echo esc_html(apply_filters( 'wpdirectorykit/listing/field/prefix', wmvc_show_data('prefix', $field), wmvc_show_data('field_id', $field)));?> |
| 144 |
<?php if(function_exists('run_wdk_currency_conversion')):?> |
| 145 |
<?php |
| 146 |
$value = strip_tags(apply_filters( 'wpdirectorykit/listing/field/value', wdk_filter_decimal(wmvc_show_data('value', $field)), wmvc_show_data('field_id', $field), FALSE)); |
| 147 |
echo esc_html(wdk_number_format_i18n($value)); |
| 148 |
?> |
| 149 |
<?php else:?> |
| 150 |
<?php if(wdk_field_option(wmvc_show_data('field_id', $field), 'is_price_format') && wdk_field_option(wmvc_show_data('field_id', $field), 'field_type') == 'NUMBER'):?> |
| 151 |
<?php |
| 152 |
$value = strip_tags(apply_filters( 'wpdirectorykit/listing/field/value', wdk_filter_decimal(wmvc_show_data('value', $field)), wmvc_show_data('field_id', $field), FALSE)); |
| 153 |
echo esc_html(wdk_number_format_i18n($value)); |
| 154 |
?> |
| 155 |
<?php else:?> |
| 156 |
<?php echo esc_html(strip_tags(apply_filters( 'wpdirectorykit/listing/field/value', (wdk_filter_decimal(wmvc_show_data('value', $field))), wmvc_show_data('field_id', $field))));?> |
| 157 |
<?php endif;?> |
| 158 |
<?php endif;?> |
| 159 |
<?php echo esc_html(apply_filters( 'wpdirectorykit/listing/field/suffix', wmvc_show_data('suffix', $field), wmvc_show_data('field_id', $field)));?> |
| 160 |
</span> |
| 161 |
<?php endforeach;?> |
| 162 |
<?php endif;?> |
| 163 |
</div> |
| 164 |
</div> |
| 165 |
<div class="wdk-right"> |
| 166 |
<a href="<?php echo esc_url($url);?>" class="wdk-btn"><?php echo wmvc_show_data('content_button_text', $settings, '');?><?php wdk_viewe($content_button_icon); ?></a> |
| 167 |
</div> |
| 168 |
</div> |
| 169 |
<?php if($layout_type == 'list'):?> |
| 170 |
</div> |
| 171 |
<?php endif;?> |
| 172 |
</div> |