Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions includes/model/Listings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1297,11 +1297,21 @@ public function render_grid_view( $post_ids ) {
}

foreach ( $post_ids as $listing_id ) {
?>
<div class="<?php Helper::directorist_column( $this->columns ); ?>">

$is_slider = apply_filters(
'directorist_listings_is_slider',
false,
$this
);
if ( ! $is_slider ) : ?>
<div class="<?php Helper::directorist_column( $this->columns ); ?>">
<?php endif; ?>

<?php $this->loop_template( 'grid', $listing_id ); ?>
</div>
<?php

<?php if ( ! $is_slider ) : ?>
</div>
<?php endif;
}
}

Expand Down Expand Up @@ -1339,7 +1349,7 @@ public function loop_template( $loop = 'grid', $id = NULL ) {
$template = ( $active_template == 'list_view_with_thumbnail' && $this->display_preview_image ) ? 'loop-list' : 'loop-list-nothumb';
Helper::get_template( 'archive/' . $template, [ 'listings' => $this ] );
}

wp_reset_postdata();
}

Expand Down
18 changes: 12 additions & 6 deletions templates/archive/grid-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@
<?php do_action( 'directorist_before_grid_listings_loop' ); ?>

<?php if ( $listings->have_posts() ) : ?>

<div class="<?php echo $listings->has_masonry() ? 'directorist-masonry' : ''; ?> <?php Helper::directorist_row(); ?>">

<?php $listings->render_grid_view( $listings->post_ids() ) ?>

<?php
ob_start();
Helper::directorist_row();
$row_class = trim( ob_get_clean() );
$default_class = ( $listings->has_masonry() ? 'directorist-masonry' : '' ) . ' ' . $row_class;
?>
<div class="<?php echo esc_attr( apply_filters(
'directorist_grid_view_wrapper_class',
$default_class,
$listings
) ); ?>">
<?php $listings->render_grid_view( $listings->post_ids() ) ?>
</div>

<?php
if ( $listings->show_pagination && 'numbered' === $listings->options['pagination_type'] ) {

Expand Down
Loading