✨refactor: Update resource filter to use global posts total and set query count
This commit is contained in:
@@ -184,7 +184,8 @@ class ContentFilterPlugin {
|
||||
|
||||
$query = $this->getQuery();
|
||||
|
||||
define('RF_TOTAL_RESOURCES', $query->found_posts);
|
||||
global $postsTotal;
|
||||
$postsTotal = $query->found_posts;
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -309,15 +310,22 @@ class ContentFilterPlugin {
|
||||
// Sorting logic
|
||||
$query_args = $this->applySorting($query_args, $sort_order);
|
||||
|
||||
return new WP_Query($query_args);
|
||||
$query = new WP_Query($query_args);
|
||||
$query->set('count', $query->found_posts);
|
||||
|
||||
return $query;
|
||||
} else {
|
||||
return new WP_Query([
|
||||
$query = new WP_Query([
|
||||
'post_type' => $postTypes,
|
||||
'posts_per_page' => $postCount,
|
||||
'paged' => max(1, get_query_var('paged', 1)), // Get current page number
|
||||
'tax_query' => $this->buildDynamicTaxQuery(),
|
||||
's' => $strSearch,
|
||||
]);
|
||||
|
||||
$query->set('count', $query->found_posts);
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user