Opal-Estate-Pro/templates/elementor-templates/opalestate-agency-collection.php

69 lines
2.5 KiB
PHP
Raw Permalink Normal View History

2019-10-01 11:09:15 +02:00
<?php
$settings = $this->get_settings_for_display();
2019-10-17 05:45:12 +02:00
extract( $settings );
2019-10-01 11:09:15 +02:00
$layout = $settings['item_layout'];
$attrs = $this->get_render_attribute_string( 'wrapper-style' );
if ( isset( $_GET['display'] ) && $_GET['display'] == 'grid' ) {
$layout = 'grid';
2019-09-10 06:27:33 +02:00
2019-10-01 11:09:15 +02:00
} elseif ( isset( $_GET['display'] ) && $_GET['display'] == 'list' ) {
$layout = 'list';
$attrs = 'class="column-list"';
}
2019-10-17 05:45:12 +02:00
if ( is_front_page() ) {
$paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1;
2019-10-01 11:09:15 +02:00
} else {
2019-10-17 05:45:12 +02:00
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
2019-10-01 11:09:15 +02:00
}
2019-10-17 05:45:12 +02:00
$onlyfeatured = 0;
// if ( isset( $_GET['s_agents'] ) ) {
$query = Opalestate_Agency_Query::get_agencies( [ 'posts_per_page' => $posts_per_page, 'paged' => $paged ], $onlyfeatured );
// } else {
// $query = Opalestate_Agency_Query::get_search_agencies_query();
// }
2019-10-01 11:09:15 +02:00
$rowcls = apply_filters( 'opalestate_row_container_class', 'opal-row' );
2019-09-10 06:27:33 +02:00
?>
2019-10-01 11:09:15 +02:00
<?php if ( $settings['enable_sortable_bar'] ): ?>
<div class="opalesate-archive-top">
<div class="<?php echo esc_attr( $rowcls ); ?>">
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="collection-counter">
<span><?php echo sprintf( esc_html__( 'Found %s Agency', 'opalestate-pro' ), '<span class="text-primary">' . $query->found_posts . '</span>' ) ?></span>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<div class="opalestate-sortable">
<?php echo opalestate_render_sortable_dropdown(); ?>
</div>
<?php opalestate_show_display_modes(); ?>
</div>
</div>
</div>
2019-09-10 06:27:33 +02:00
<?php endif; ?>
<div class="agency-collection-wrap">
2019-10-01 11:09:15 +02:00
<?php if ( $query->have_posts() ): ?>
<div class="agency-container">
<div <?php echo wp_kses_post( $attrs ); ?>>
<?php $cnt = 0;
while ( $query->have_posts() ): $query->the_post(); ?>
<div class="column-item ">
<?php echo opalestate_load_template_path( 'content-agency-' . $layout ); ?>
</div>
2019-09-10 06:27:33 +02:00
<?php endwhile; ?>
2019-10-01 11:09:15 +02:00
</div>
</div>
2019-10-17 05:45:12 +02:00
<?php if ( isset( $pagination ) && $pagination && ( ! isset( $enable_carousel ) || ! $enable_carousel ) ): ?>
<div class="w-pagination"><?php opalestate_pagination( $pagination_page_limit ); ?></div>
2019-10-01 11:09:15 +02:00
<?php endif; ?>
2019-09-10 06:27:33 +02:00
<?php else: ?>
2019-10-01 11:09:15 +02:00
<div class="agency-results">
<?php echo opalestate_load_template_path( 'content-no-results' ); ?>
</div>
2019-09-10 06:27:33 +02:00
<?php endif; ?>
</div>
<?php wp_reset_postdata(); ?>