fix(widgets): restore article list rendering and reference styles
This commit is contained in:
1 parent
4ea00f1322
commit
fc04bf65e6
18 files changed
+345
-97
No files matched your search
@@ -19,7 +19,12 @@ class WP_Query {
|
||||
public function __construct(public array $query_args = []) {
|
||||
$GLOBALS['discovery_queries'][] = $query_args;
|
||||
$cats = array_map('intval', (array) ($query_args['category__in'] ?? []));
|
||||
$rows = array_values(array_filter($GLOBALS['discovery_posts'], static fn(array $post): bool => !$cats || in_array($post['cat'], $cats, true)));
|
||||
$excluded = [];
|
||||
foreach (array_filter(explode(',', (string) ($query_args['cat'] ?? ''))) as $cat) {
|
||||
if ((int) $cat > 0) $cats[] = (int) $cat;
|
||||
if ((int) $cat < 0) $excluded[] = abs((int) $cat);
|
||||
}
|
||||
$rows = array_values(array_filter($GLOBALS['discovery_posts'], static fn(array $post): bool => (!$cats || in_array($post['cat'], $cats, true)) && !in_array($post['cat'], $excluded, true)));
|
||||
$this->found_posts = count($rows);
|
||||
$per_page = max(1, (int) ($query_args['posts_per_page'] ?? 10));
|
||||
$this->max_num_pages = (int) ceil($this->found_posts / $per_page);
|
||||
|
||||
Reference in new issue
Block a user