refactor: remove forum and topic feature chains
This commit is contained in:
@@ -86,21 +86,6 @@ class WidgetMainPosts extends \WP_Widget {
|
||||
$query['order'] = $order;
|
||||
}
|
||||
|
||||
// Topics taxonomy (CSV term IDs).
|
||||
$topics_raw = trim((string) ($instance['topics'] ?? ''));
|
||||
if ($topics_raw !== '' && taxonomy_exists('topics')) {
|
||||
$topic_ids = array_values(array_filter(array_map('intval', preg_split('/[,,\s]+/', $topics_raw) ?: [])));
|
||||
if ($topic_ids) {
|
||||
$query['tax_query'] = [
|
||||
[
|
||||
'taxonomy' => 'topics',
|
||||
'field' => 'term_id',
|
||||
'terms' => $topic_ids,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Pay type filter (reading/download/gallery/video/vip or any paid).
|
||||
$pay_type = sanitize_key((string) ($instance['pay_type'] ?? ''));
|
||||
if ($pay_type !== '' && $pay_type !== '0' && $pay_type !== 'no') {
|
||||
@@ -252,7 +237,6 @@ class WidgetMainPosts extends \WP_Widget {
|
||||
'order' => strtoupper(sanitize_key((string) ($instance['order'] ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'cat' => (int) ($instance['cat'] ?? 0),
|
||||
'limit_day' => (int) ($instance['limit_day'] ?? 0),
|
||||
'topics' => (string) ($instance['topics'] ?? ''),
|
||||
'pay_type' => sanitize_key((string) ($instance['pay_type'] ?? '')),
|
||||
'style' => sanitize_key((string) ($instance['style'] ?? 'list')),
|
||||
'show_thumb' => !isset($instance['show_thumb']) || !empty($instance['show_thumb']) ? 1 : 0,
|
||||
@@ -318,7 +302,6 @@ class WidgetMainPosts extends \WP_Widget {
|
||||
'order' => strtoupper(sanitize_key((string) ($instance['order'] ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'cat' => (int) ($instance['cat'] ?? 0),
|
||||
'limit_day' => (int) ($instance['limit_day'] ?? 0),
|
||||
'topics' => (string) ($instance['topics'] ?? ''),
|
||||
'pay_type' => sanitize_key((string) ($instance['pay_type'] ?? '')),
|
||||
'style' => $style,
|
||||
'show_thumb' => !isset($instance['show_thumb']) || !empty($instance['show_thumb']) ? 1 : 0,
|
||||
@@ -423,11 +406,6 @@ class WidgetMainPosts extends \WP_Widget {
|
||||
</select>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label><?php esc_html_e('专题 topics ID(逗号)', 'aksrt'); ?>
|
||||
<input class="widefat" type="text" name="<?php echo esc_attr($this->get_field_name('topics')); ?>" value="<?php echo esc_attr((string) ($instance['topics'] ?? '')); ?>">
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label><?php esc_html_e('付费类型', 'aksrt'); ?>
|
||||
<select name="<?php echo esc_attr($this->get_field_name('pay_type')); ?>">
|
||||
@@ -470,7 +448,6 @@ class WidgetMainPosts extends \WP_Widget {
|
||||
'order' => strtoupper(sanitize_key((string) ($new_instance['order'] ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'cat' => max(0, (int) ($new_instance['cat'] ?? 0)),
|
||||
'limit_day' => max(0, (int) ($new_instance['limit_day'] ?? 0)),
|
||||
'topics' => sanitize_text_field((string) ($new_instance['topics'] ?? '')),
|
||||
'pay_type' => sanitize_key((string) ($new_instance['pay_type'] ?? '')),
|
||||
'paginate' => $paginate,
|
||||
'load_mode' => sanitize_key((string) ($new_instance['load_mode'] ?? 'detail')) === 'ajax' ? 'ajax' : 'detail',
|
||||
|
||||
Reference in New Issue
Block a user