Opal-Estate-Pro/templates/elementor-templates/opalestate-city-list.php

68 lines
2.1 KiB
PHP
Raw Permalink Normal View History

2019-09-10 06:27:33 +02:00
<?php
$args = [
'number' => $settings['limit'],
'orderby' => $settings['orderby'],
'order' => $settings['order'],
];
if ( $settings['categories'] ) {
$args['slug'] = $settings['categories'];
}
$terms = Opalestate_Taxonomy_City::get_list( $args );
$attrs = $this->get_render_attribute_string( 'wrapper-style' );
?>
<div class="city-list-collection ">
2019-10-01 11:09:15 +02:00
<div <?php echo wp_kses_post( $attrs ); ?>>
2019-09-10 06:27:33 +02:00
<?php foreach ( $terms as $city ): ?>
<?php
$tax_link = get_term_link( $city->term_id );
$image = wp_get_attachment_image_url( get_term_meta( $city->term_id, 'opalestate_city_image_id', true ), 'full' );
?>
<div class="column-item property-city ">
<a href="<?php echo esc_url( $tax_link ); ?>" class="city-overlay"></a>
<?php
$style = '';
if ( $image ) {
$style = 'style="background-image:url(' . esc_url( $image ) . ')"';
} else {
$style = 'style="background-image:url(' . opalestate_get_image_placeholder_src() . ')"';
}
?>
2019-10-01 11:09:15 +02:00
<div class="property-city-bg" <?php echo wp_kses_post( $style ); ?>>
2019-09-10 06:27:33 +02:00
</div>
<div class="static-content">
<div class="property-city-info text-center">
<?php if ( $city->name ) : ?>
<h4 class="property-city-title">
<a href="<?php echo esc_url( $tax_link ); ?>"><?php echo esc_html( $city->name ); ?></a>
</h4>
<?php endif; ?>
<?php if ( $city->count ) : ?>
<div class="property-city-count">
<?php
printf(
/* translators: 1: number of properties */
_nx(
'%1$s Property',
'%1$s Properties',
$city->count,
2019-10-01 11:09:15 +02:00
'count properties',
2019-09-10 06:27:33 +02:00
'opalestate-pro'
),
number_format_i18n( $city->count )
);
?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>