feat(widgets): number paginate for category block/recent/product tab

Extend form/query/REST number pager support to category block and forum
recent; product tab form exposes number mode already supported by list.
This commit is contained in:
kate522 committed 2026-07-21 13:13:07 +08:00
1 parent 80991d8347
commit 1de0cac8df
2 files changed
+21 -14

No files matched your search

@@ -79,6 +79,7 @@ class WidgetForumRecentTopics extends \WP_Widget {
<label><?php esc_html_e('分页', 'aksrt'); ?>
<select name="<?php echo esc_attr($this->get_field_name('paginate')); ?>">
<option value="ajax" <?php selected(($instance['paginate'] ?? 'ajax'), 'ajax'); ?>><?php esc_html_e('AJAX', 'aksrt'); ?></option>
<option value="number" <?php selected(($instance['paginate'] ?? ''), 'number'); ?>><?php esc_html_e('数字分页', 'aksrt'); ?></option>
<option value="none" <?php selected(($instance['paginate'] ?? ''), 'none'); ?>><?php esc_html_e('无', 'aksrt'); ?></option>
</select>
</label>
@@ -96,7 +97,7 @@ class WidgetForumRecentTopics extends \WP_Widget {
'count' => max(1, min(20, (int) ($new_instance['count'] ?? 5))),
'plate' => max(0, (int) ($new_instance['plate'] ?? 0)),
'style' => $style,
'paginate' => sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')) === 'none' ? 'none' : 'ajax',
'paginate' => in_array(sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')), ['none', 'ajax', 'number'], true) ? sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')) : 'ajax',
];
}
}