From 9f485cbe451a51a7f0a54fcaf4fadba0a768f384 Mon Sep 17 00:00:00 2001
From: unknown
Date: Tue, 21 Jul 2026 14:36:01 +0800
Subject: [PATCH] feat(widgets): per-tab topics/limit_day/pay_type filters
TabPosts each tab can filter topics taxonomy, date window and pay type;
REST and widget-set.js pass the extra query args.
---
src/AKSRT/Core/WidgetAjax.php | 5 ++++-
src/AKSRT/Widgets/TabPostsWidget.php | 25 ++++++++++++++++++++++++-
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/AKSRT/Core/WidgetAjax.php b/src/AKSRT/Core/WidgetAjax.php
index 1a3cdbf8..aa293aee 100644
--- a/src/AKSRT/Core/WidgetAjax.php
+++ b/src/AKSRT/Core/WidgetAjax.php
@@ -93,7 +93,10 @@ class WidgetAjax {
'orderby' => sanitize_key((string) ($request->get_param('orderby') ?? 'date')),
'count' => max(0, min(20, (int) ($request->get_param('tab_count') ?? 0))),
'enabled' => true,
- ];
+
+ 'topics' => sanitize_text_field((string) ($request->get_param('topics') ?? '')),
+ 'limit_day' => max(0, (int) ($request->get_param('limit_day') ?? 0)),
+ 'pay_type' => sanitize_key((string) ($request->get_param('pay_type') ?? '')),];
$opts = [
'style' => $style,
'paginate' => $paginate,
diff --git a/src/AKSRT/Widgets/TabPostsWidget.php b/src/AKSRT/Widgets/TabPostsWidget.php
index 1e9dcdb9..fc42a830 100644
--- a/src/AKSRT/Widgets/TabPostsWidget.php
+++ b/src/AKSRT/Widgets/TabPostsWidget.php
@@ -107,6 +107,9 @@ class TabPostsWidget extends \WP_Widget {
'count' => max(1, min(30, $count)),
'orderby' => sanitize_key((string) ($tab['orderby'] ?? 'date')),
'cat' => absint($tab['category_id'] ?? 0),
+ 'topics' => sanitize_text_field((string) ($tab['topics'] ?? '')),
+ 'limit_day' => max(0, (int) ($tab['limit_day'] ?? 0)),
+ 'pay_type' => sanitize_key((string) ($tab['pay_type'] ?? '')),
'style' => $style,
'show_thumb' => !isset($opts['show_thumb']) ? 1 : (int) $opts['show_thumb'],
'show_meta' => !isset($opts['show_meta']) ? 1 : (int) $opts['show_meta'],
@@ -213,6 +216,9 @@ class TabPostsWidget extends \WP_Widget {
data-orderby=""
data-cat=""
data-tab-count=""
+ data-topics=""
+ data-limit-day=""
+ data-pay-type=""
aria-selected=""
>
@@ -295,7 +301,7 @@ class TabPostsWidget extends \WP_Widget {
$max_tabs = 8;
$tabs = array_slice($tabs, 0, $max_tabs);
while (count($tabs) < 3) {
- $tabs[] = ['title' => '', 'category_id' => 0, 'orderby' => 'date', 'count' => 0, 'enabled' => false];
+ $tabs[] = ['title' => '', 'category_id' => 0, 'orderby' => 'date', 'count' => 0, 'topics' => '', 'limit_day' => 0, 'pay_type' => '', 'enabled' => false];
}
foreach ($tabs as $i => $tab) :
?>
@@ -323,6 +329,23 @@ class TabPostsWidget extends \WP_Widget {
" value="">
+
+
+ " value="">
+
+
+
+ " value="">
+
+
+
+
+