From a6534ffde1b3bc1459e8fe77fd595e21898467b6 Mon Sep 17 00:00:00 2001 From: Yasir Arafat <148990700+Arafat-plugins@users.noreply.github.com> Date: Sun, 25 Jan 2026 09:03:29 +0600 Subject: [PATCH 1/4] filter hooks added for slider --- includes/model/Listings.php | 20 +++++++++++++++----- templates/archive/grid-view.php | 18 ++++++++++++------ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/includes/model/Listings.php b/includes/model/Listings.php index d868b3410c..b07b512e0b 100644 --- a/includes/model/Listings.php +++ b/includes/model/Listings.php @@ -1297,11 +1297,21 @@ public function render_grid_view( $post_ids ) { } foreach ( $post_ids as $listing_id ) { - ?> -
+ + $is_slider = apply_filters( + 'addonskit_directorist_is_slider', + false, + $this + ); + if ( ! $is_slider ) : ?> +
+ + loop_template( 'grid', $listing_id ); ?> -
- +
+ display_preview_image ) ? 'loop-list' : 'loop-list-nothumb'; Helper::get_template( 'archive/' . $template, [ 'listings' => $this ] ); } - + wp_reset_postdata(); } diff --git a/templates/archive/grid-view.php b/templates/archive/grid-view.php index f6da8c3f97..73cbeec475 100644 --- a/templates/archive/grid-view.php +++ b/templates/archive/grid-view.php @@ -16,13 +16,19 @@ have_posts() ) : ?> - -
- - render_grid_view( $listings->post_ids() ) ?> - + has_masonry() ? 'directorist-masonry' : '' ) . ' ' . $row_class; + ?> +
+ render_grid_view( $listings->post_ids() ) ?>
- show_pagination && 'numbered' === $listings->options['pagination_type'] ) { From 5b7707d7dd21162cf425a01dece94343206d8256 Mon Sep 17 00:00:00 2001 From: Yasir Arafat <148990700+Arafat-plugins@users.noreply.github.com> Date: Tue, 27 Jan 2026 11:40:28 +0600 Subject: [PATCH 2/4] hook name changed --- includes/model/Listings.php | 2 +- templates/archive/grid-view.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/model/Listings.php b/includes/model/Listings.php index b07b512e0b..928f306f2a 100644 --- a/includes/model/Listings.php +++ b/includes/model/Listings.php @@ -1299,7 +1299,7 @@ public function render_grid_view( $post_ids ) { foreach ( $post_ids as $listing_id ) { $is_slider = apply_filters( - 'addonskit_directorist_is_slider', + 'directorist_listings_is_slider', false, $this ); diff --git a/templates/archive/grid-view.php b/templates/archive/grid-view.php index 73cbeec475..8ba59b60ba 100644 --- a/templates/archive/grid-view.php +++ b/templates/archive/grid-view.php @@ -23,7 +23,7 @@ $default_class = ( $listings->has_masonry() ? 'directorist-masonry' : '' ) . ' ' . $row_class; ?>
From b82ce63fbaa577c66718e6f53614029c28bee7d5 Mon Sep 17 00:00:00 2001 From: Yasir Arafat <148990700+Arafat-plugins@users.noreply.github.com> Date: Tue, 27 Jan 2026 11:53:04 +0600 Subject: [PATCH 3/4] hooks name fixed --- includes/model/Listings.php | 2 +- templates/archive/grid-view.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/model/Listings.php b/includes/model/Listings.php index b07b512e0b..928f306f2a 100644 --- a/includes/model/Listings.php +++ b/includes/model/Listings.php @@ -1299,7 +1299,7 @@ public function render_grid_view( $post_ids ) { foreach ( $post_ids as $listing_id ) { $is_slider = apply_filters( - 'addonskit_directorist_is_slider', + 'directorist_listings_is_slider', false, $this ); diff --git a/templates/archive/grid-view.php b/templates/archive/grid-view.php index 73cbeec475..8ba59b60ba 100644 --- a/templates/archive/grid-view.php +++ b/templates/archive/grid-view.php @@ -23,7 +23,7 @@ $default_class = ( $listings->has_masonry() ? 'directorist-masonry' : '' ) . ' ' . $row_class; ?>
From 3315c5beb0b5db252c628d5b9b970c527523e334 Mon Sep 17 00:00:00 2001 From: Yasir Arafat <148990700+Arafat-plugins@users.noreply.github.com> Date: Wed, 28 Jan 2026 08:52:43 +0600 Subject: [PATCH 4/4] hook name changed and codes cleaning and speed checked --- includes/model/Listings.php | 43 +++++++++++++++++++++++++-------- templates/archive/grid-view.php | 6 ++++- templates/archive/list-view.php | 32 +++++++++++------------- templates/archive/loop-grid.php | 1 - 4 files changed, 52 insertions(+), 30 deletions(-) diff --git a/includes/model/Listings.php b/includes/model/Listings.php index 928f306f2a..f4d2a26178 100644 --- a/includes/model/Listings.php +++ b/includes/model/Listings.php @@ -1282,11 +1282,20 @@ public function render_list_view( $post_ids ) { } foreach ( $post_ids as $listing_id ) { - ?> -
- loop_template( 'list', $listing_id ); ?> -
- +
+ loop_template( 'list', $listing_id ); ?> +
+ loop_template( 'list', $listing_id ); + endif; } } @@ -1299,17 +1308,31 @@ public function render_grid_view( $post_ids ) { foreach ( $post_ids as $listing_id ) { $is_slider = apply_filters( - 'directorist_listings_is_slider', + 'directorist_listings_grid_items_view_before', false, $this - ); - if ( ! $is_slider ) : ?> -
+ ); + + $default_wrapper_class = ''; + ob_start(); + Helper::directorist_column( $this->columns ); + $default_wrapper_class = trim( ob_get_clean() ); + + $grid_item_wrapper_class = apply_filters( + 'directorist_listings_grid_item_wrapper_class', + $default_wrapper_class, + $this + ); + + $has_grid_item_wrapper = ( ! $is_slider && '' !== trim( (string) $grid_item_wrapper_class ) ); + + if ( $has_grid_item_wrapper ) : ?> +
loop_template( 'grid', $listing_id ); ?> - +
has_masonry() ? 'directorist-masonry' : '' ) . ' ' . $row_class; ?> -
"> + render_grid_view( $listings->post_ids() ) ?> +
+ show_pagination && 'numbered' === $listings->options['pagination_type'] ) { diff --git a/templates/archive/list-view.php b/templates/archive/list-view.php index 8e75fb166e..564173f725 100644 --- a/templates/archive/list-view.php +++ b/templates/archive/list-view.php @@ -16,24 +16,20 @@ have_posts() ) : ?> - -
- render_list_view( $listings->post_ids() ) ?> -
-
- - show_pagination && 'numbered' === $listings->options['pagination_type'] ) { - - do_action( 'directorist_before_listings_pagination' ); - - $listings->pagination(); - - do_action( 'directorist_after_listings_pagination' ); - } - ?> - - + +
+ render_list_view( $listings->post_ids() ) ?> +
diff --git a/templates/archive/loop-grid.php b/templates/archive/loop-grid.php index 18810cd02a..7991f12f7f 100644 --- a/templates/archive/loop-grid.php +++ b/templates/archive/loop-grid.php @@ -6,7 +6,6 @@ */ if ( ! defined( 'ABSPATH' ) ) exit; - $loop_fields = $listings->loop['card_fields']['template_data']['grid_view_with_thumbnail']; ?>