File: /var/www/html/wpprotonperinggit/wp-content/themes/voiture/template-listings/archive-listing.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
global $wp_query;
if ( get_query_var( 'paged' ) ) {
$paged = get_query_var( 'paged' );
} elseif ( get_query_var( 'page' ) ) {
$paged = get_query_var( 'page' );
} else {
$paged = 1;
}
$query_args = array(
'post_type' => 'listing',
'post_status' => 'publish',
'post_per_page' => wp_cardealer_get_option('number_listings_per_page', 10),
'paged' => $paged,
);
$params = array();
$taxs = ['type', 'category', 'color', 'condition', 'cylinder', 'door', 'drive_type', 'feature', 'fuel_type', 'make', 'location', 'model', 'offer_type', 'transmission', 'label'];
foreach ($taxs as $tax) {
if ( is_tax('listing_'.$tax) ) {
$term = $wp_query->queried_object;
if ( isset( $term->slug) ) {
$params['filter-'.$tax] = $term->slug;
}
}
}
if ( WP_CarDealer_Abstract_Filter::has_filter() ) {
$params = array_merge($params, $_GET);
}
$listings = WP_CarDealer_Query::get_posts($query_args, $params);
if ( isset( $_REQUEST['load_type'] ) && WP_CarDealer_Mixes::is_ajax_request() ) {
if ( 'items' !== $_REQUEST['load_type'] ) {
echo WP_CarDealer_Template_Loader::get_template_part('archive-listing-ajax-full', array('listings' => $listings));
} else {
echo WP_CarDealer_Template_Loader::get_template_part('archive-listing-ajax-listings', array('listings' => $listings));
}
} else {
get_header();
$layout_type = voiture_get_listings_layout_type();
$args = array(
'listings' => $listings
);
if ( $layout_type == 'half-map' ) {
$first_class = 'col-lg-5 col-md-6 col-xs-12 first_class';
$second_class = 'col-lg-7 col-md-6 col-xs-12 second_class';
$sidebar = 'listings-filter-half-map';
$sidebar_wrapper_class = 'listings-filter-sidebar-wrapper';
?>
<section id="main-container" class="inner layout-type-<?php echo esc_attr($layout_type); ?>">
<div class="mobile-groups-button hidden-lg hidden-md clearfix text-center">
<button class=" btn btn-sm btn-theme btn-view-map" type="button"><i class="fas fa-map pre" aria-hidden="true"></i> <?php esc_html_e( 'Map View', 'voiture' ); ?></button>
<button class=" btn btn-sm btn-theme btn-view-listing hidden-xs hidden-sm" type="button"><i class="fas fa-list pre" aria-hidden="true"></i> <?php esc_html_e( 'Listings View', 'voiture' ); ?></button>
</div>
<?php if( is_active_sidebar( $sidebar ) ) { ?>
<div class="<?php echo esc_attr($sidebar_wrapper_class); ?>">
<span class="close-filter"><i class="ti-close"></i></span>
<div class="inner">
<?php dynamic_sidebar( $sidebar ); ?>
</div>
</div>
<div class="over-dark-filter"></div>
<?php } ?>
<div class="row no-margin layout-type-<?php echo esc_attr($layout_type); ?>">
<div id="main-content" class="<?php echo esc_attr($first_class); ?>">
<div class="inner-left">
<div class="content-listing">
<?php
echo WP_CarDealer_Template_Loader::get_template_part('loop/listing/archive-inner', $args);
echo WP_CarDealer_Template_Loader::get_template_part('loop/listing/pagination', array('listings' => $listings));
?>
</div>
</div>
</div><!-- .content-area -->
<div class="<?php echo esc_attr($second_class); ?>">
<div id="listings-google-maps" class="fix-map hidden-xs hidden-sm"></div>
</div>
</div>
</section>
<?php
} else {
$sidebar_configs = voiture_get_listings_layout_configs();
$filter = (voiture_get_config('listings_filter_sidebar', 'listings-filter'))? voiture_get_config('listings_filter_sidebar', 'listings-filter') :'';
?>
<section id="main-container" class="inner layout-type-<?php echo esc_attr($layout_type.' '.$filter); ?> <?php echo ((voiture_get_listings_show_filter_top())?'has-filter-top':''); ?>">
<?php
$filter_top_sidebar = voiture_get_listings_filter_top_sidebar();
if ( is_active_sidebar( $filter_top_sidebar ) && voiture_get_listings_show_filter_top() ) { ?>
<div class="listings-filter-top-sidebar-wrapper filter-top-sidebar-wrapper">
<?php dynamic_sidebar( $filter_top_sidebar ); ?>
</div>
<?php } ?>
<?php if ( $layout_type == 'top-map' ) { ?>
<div class="mobile-groups-button hidden-lg hidden-md clearfix text-center">
<button class=" btn btn-sm btn-theme btn-view-map" type="button"><i class="fas fa-map pre" aria-hidden="true"></i> <?php esc_html_e( 'Map View', 'voiture' ); ?></button>
<button class=" btn btn-sm btn-theme btn-view-listing hidden-sm hidden-xs" type="button"><i class="fas fa-list pre" aria-hidden="true"></i> <?php esc_html_e( 'Listings View', 'voiture' ); ?></button>
</div>
<div id="listings-google-maps" class="hidden-sm hidden-xs top-map"></div>
<?php } ?>
<?php
voiture_render_breadcrumbs();
?>
<div class="main-content <?php echo apply_filters('voiture_listing_content_class', 'container');?> inner">
<?php voiture_before_content( $sidebar_configs ); ?>
<div class="row">
<?php voiture_display_sidebar_left( $sidebar_configs ); ?>
<div id="main-content" class="col-sm-12 <?php echo esc_attr($sidebar_configs['main']['class']); ?>">
<main id="main" class="site-main layout-type-<?php echo esc_attr($layout_type); ?>" role="main">
<?php
echo WP_CarDealer_Template_Loader::get_template_part('loop/listing/archive-inner', $args);
echo WP_CarDealer_Template_Loader::get_template_part('loop/listing/pagination', array('listings' => $listings));
?>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php voiture_display_sidebar_right( $sidebar_configs ); ?>
</div>
</div>
</section>
<?php
}
get_footer();
}