refactor: remove forum and topic feature chains
This commit is contained in:
1 parent
698e3750f9
commit
6c6c462df8
69 files changed
+339
-2057
No files matched your search
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Special Page Cover
|
||||
*
|
||||
* Renders the cover section for a special/topic page with
|
||||
* background image, title, summary, and metadata.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$post_id = get_the_ID();
|
||||
$cover_img = get_the_post_thumbnail_url($post_id, 'large');
|
||||
$default_cover = isset($default_cover) ? $default_cover : '';
|
||||
$show_post_count = isset($show_post_count) ? $show_post_count : true;
|
||||
if (empty($cover_img) && !empty($default_cover)) {
|
||||
$cover_img = $default_cover;
|
||||
}
|
||||
$title = get_the_title();
|
||||
$excerpt = get_the_excerpt();
|
||||
$summary_len = isset($summary_len) ? (int) $summary_len : 200;
|
||||
|
||||
if ($excerpt) {
|
||||
$excerpt = wp_trim_words($excerpt, $summary_len, '...');
|
||||
}
|
||||
|
||||
// Per-page meta
|
||||
$cover_color = get_post_meta($post_id, '_aksrt_special_cover_color', true);
|
||||
$cover_style = '';
|
||||
if ($cover_color) {
|
||||
$cover_style = 'background-color:' . sanitize_hex_color($cover_color) . ';';
|
||||
}
|
||||
?>
|
||||
<header class="aksrt-special-cover" <?php echo $cover_style ? 'style="' . esc_attr($cover_style) . '"' : ''; ?>>
|
||||
<?php if ($cover_img) : ?>
|
||||
<div class="aksrt-special-cover__bg">
|
||||
<img src="<?php echo esc_url($cover_img); ?>" alt=""<?php echo function_exists('aksrt_lazy_loading') ? aksrt_lazy_loading('cover') : ' loading="lazy"'; ?> class="aksrt-special-cover__img">
|
||||
<div class="aksrt-special-cover__overlay"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="aksrt-special-cover__content">
|
||||
<h1 class="aksrt-special-cover__title"><?php echo esc_html($title); ?></h1>
|
||||
|
||||
<?php if ($excerpt) : ?>
|
||||
<p class="aksrt-special-cover__summary"><?php echo esc_html($excerpt); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="aksrt-special-cover__meta">
|
||||
<span class="aksrt-special-cover__date">
|
||||
<i class="fas fa-calendar-alt"></i>
|
||||
<?php echo esc_html(get_the_date()); ?>
|
||||
</span>
|
||||
<?php
|
||||
if ($show_post_count) :
|
||||
$children = get_pages(['child_of' => $post_id, 'parent' => $post_id, 'post_status' => 'publish', 'fields' => 'ids']);
|
||||
if (!empty($children)) : ?>
|
||||
<span class="aksrt-special-cover__count">
|
||||
<i class="fas fa-file-alt"></i>
|
||||
<?php printf(esc_html__('%d 篇文章', 'aksrt'), count($children)); ?>
|
||||
</span>
|
||||
<?php endif; endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Special Page Grid
|
||||
*
|
||||
* Renders the content grid for a special/topic page.
|
||||
* Supports grid, list, and masonry layouts.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$posts = isset($posts) ? $posts : [];
|
||||
$layout = isset($layout) ? $layout : 'grid';
|
||||
$columns = isset($columns) ? (int) $columns : 2;
|
||||
$show_dates = isset($show_dates) ? $show_dates : true;
|
||||
|
||||
if (empty($posts)) return;
|
||||
?>
|
||||
<div class="aksrt-special-grid aksrt-special-grid--<?php echo esc_attr($layout); ?>" style="--aksrt-cols:<?php echo esc_attr((string) $columns); ?>">
|
||||
<?php foreach ($posts as $post) :
|
||||
setup_postdata($post);
|
||||
$img = get_the_post_thumbnail_url($post->ID, 'medium');
|
||||
?>
|
||||
<article class="aksrt-special-grid__item">
|
||||
<a href="<?php echo esc_url(get_permalink($post->ID)); ?>" class="aksrt-special-grid__link">
|
||||
<?php if ($img) : ?>
|
||||
<div class="aksrt-special-grid__thumb">
|
||||
<img src="<?php echo esc_url($img); ?>" alt=""<?php echo function_exists('aksrt_lazy_loading') ? aksrt_lazy_loading('other') : ' loading="lazy"'; ?>>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="aksrt-special-grid__body">
|
||||
<h3 class="aksrt-special-grid__title"><?php echo esc_html($post->post_title); ?></h3>
|
||||
<?php if ($post->post_excerpt) : ?>
|
||||
<p class="aksrt-special-grid__desc"><?php echo esc_html(wp_trim_words($post->post_excerpt, 20)); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if ($show_dates) : ?>
|
||||
<time class="aksrt-special-grid__date" datetime="<?php echo esc_attr(get_the_date('c', $post->ID)); ?>">
|
||||
<?php echo esc_html(get_the_date('', $post->ID)); ?>
|
||||
</time>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</a>
|
||||
</article>
|
||||
<?php endforeach; wp_reset_postdata(); ?>
|
||||
</div>
|
||||
@@ -98,19 +98,6 @@ if (is_wp_error($categories)) {
|
||||
}
|
||||
$current_cats = $edit_post ? wp_get_post_categories($edit_post->ID) : [];
|
||||
|
||||
$topics_terms = [];
|
||||
$current_topics = [];
|
||||
if (!empty($settings['topics_s']) && taxonomy_exists('topics')) {
|
||||
$topics_terms = get_terms(['taxonomy' => 'topics', 'hide_empty' => false, 'orderby' => 'name', 'order' => 'ASC']);
|
||||
if (is_wp_error($topics_terms)) {
|
||||
$topics_terms = [];
|
||||
}
|
||||
if ($edit_post) {
|
||||
$t = wp_get_object_terms($edit_post->ID, 'topics', ['fields' => 'ids']);
|
||||
$current_topics = is_wp_error($t) ? [] : $t;
|
||||
}
|
||||
}
|
||||
|
||||
$custom_dimensions = [];
|
||||
$current_cf = [];
|
||||
if (!empty($settings['custom_filter_s']) && class_exists('\AKSRT\Settings\Settings')) {
|
||||
@@ -192,8 +179,6 @@ return [
|
||||
'featured_args' => $featured_args,
|
||||
'categories' => $categories,
|
||||
'current_cats' => $current_cats,
|
||||
'topics_terms' => $topics_terms,
|
||||
'current_topics' => $current_topics,
|
||||
'custom_dimensions' => $custom_dimensions,
|
||||
'current_cf' => $current_cf,
|
||||
'current_title' => $current_title,
|
||||
|
||||
@@ -48,18 +48,6 @@ if (file_exists($term_helper)) {
|
||||
</details>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($settings['topics_s']) && !empty($ctx['topics_terms'])) : ?>
|
||||
<details class="aksrt-submit-drop">
|
||||
<summary>
|
||||
<span><i class="fa fa-cube"></i> <?php esc_html_e('专题', 'aksrt'); ?></span>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</summary>
|
||||
<div class="aksrt-submit-drop__body">
|
||||
<?php aksrt_submit_render_term_checks($ctx['topics_terms'], array_map('intval', $ctx['current_topics']), 'topics', 'topics'); ?>
|
||||
</div>
|
||||
</details>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($settings['custom_filter_s']) && !empty($ctx['custom_dimensions'])) : ?>
|
||||
<?php foreach ($ctx['custom_dimensions'] as $dim) :
|
||||
$key = sanitize_key((string) ($dim['key'] ?? ''));
|
||||
|
||||
@@ -30,16 +30,16 @@ extract($args, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_ext
|
||||
$items = is_array($list['items'] ?? null) ? $list['items'] : [];
|
||||
$total_pages = max(1, (int) ($list['total_pages'] ?? 1));
|
||||
?>
|
||||
<div class="uh-forum__subtabs uh-follow__subtabs">
|
||||
<a class="uh-forum__subtab<?php echo $follow_sub === 'following' ? ' is-active' : ''; ?>"
|
||||
<div class="uh-follow__subtabs">
|
||||
<a class="uh-follow__subtab<?php echo $follow_sub === 'following' ? ' is-active' : ''; ?>"
|
||||
href="<?php echo esc_url(add_query_arg(['tab' => 'follow', 'follow_sub' => 'following', 'follow_page' => 1], $home_url)); ?>">
|
||||
<i class="fas fa-user-plus"></i> <?php esc_html_e('关注', 'aksrt'); ?>
|
||||
<span class="uh-forum__subtab-count"><?php echo esc_html((string) $following_count); ?></span>
|
||||
<span class="uh-follow__subtab-count"><?php echo esc_html((string) $following_count); ?></span>
|
||||
</a>
|
||||
<a class="uh-forum__subtab<?php echo $follow_sub === 'followers' ? ' is-active' : ''; ?>"
|
||||
<a class="uh-follow__subtab<?php echo $follow_sub === 'followers' ? ' is-active' : ''; ?>"
|
||||
href="<?php echo esc_url(add_query_arg(['tab' => 'follow', 'follow_sub' => 'followers', 'follow_page' => 1], $home_url)); ?>">
|
||||
<i class="fas fa-users"></i> <?php esc_html_e('粉丝', 'aksrt'); ?>
|
||||
<span class="uh-forum__subtab-count"><?php echo esc_html((string) $follower_count); ?></span>
|
||||
<span class="uh-follow__subtab-count"><?php echo esc_html((string) $follower_count); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -64,7 +64,7 @@ extract($args, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_ext
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php if ($total_pages > 1) : ?>
|
||||
<div class="uh-forum__pagination">
|
||||
<div class="uh-follow__pagination">
|
||||
<?php
|
||||
echo paginate_links([
|
||||
'base' => add_query_arg(['tab' => 'follow', 'follow_sub' => $follow_sub, 'follow_page' => '%#%'], $home_url),
|
||||
|
||||
Reference in new issue
Block a user