PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.86
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.86
51.1.86 51.1.84 51.1.85 51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 All 40 releases
← All changes | includes/extensions/Docs_KB/templates/taxonomy-docs.php +131 -162 51.1.44 → 51.1.86 View file →
@@ -1,206 +1,175 @@
1 1 <?php
2 2 /**
3 - * Docs Category (Taxonomy) Template
3 + * Template: Taxonomy Archive (category & tag pages)
4 4 *
5 + * Apple Liquid-Glass design – category header, subcategories, articles list, pagination.
6 + *
5 7 * @package King_Addons
6 8 */
7 9
8 -if (!defined('ABSPATH')) {
9 - exit;
10 -}
10 +defined('ABSPATH') || exit;
11 11
12 -$options = \King_Addons\Docs_KB::instance()->get_options();
13 -$term = get_queried_object();
14 -$search_enabled = !empty($options['search_enabled']);
15 -$primary_color = $options['primary_color'] ?? '#0066ff';
12 +$ext = \King_Addons\Docs_KB::instance();
13 +$options = $ext->get_options();
14 +$mode = $options['dark_mode'] ?? 'auto';
15 +$primary = $options['primary_color'] ?? '#0071e3';
16 16
17 -// Get category meta
18 -$icon = get_term_meta($term->term_id, '_kng_doc_cat_icon', true);
17 +$term = get_queried_object();
18 +$is_tag = is_tax('kng_doc_tag');
19 +$icon_name = get_term_meta($term->term_id, 'kng_doc_cat_icon', true) ?: 'folder';
19 20
20 -// Get docs in this category
21 -$docs_query = new WP_Query([
22 - 'post_type' => \King_Addons\Docs_KB::POST_TYPE,
23 - 'posts_per_page' => $options['docs_per_page'] ?? 10,
24 - 'paged' => get_query_var('paged') ?: 1,
25 - 'tax_query' => [
26 - [
27 - 'taxonomy' => \King_Addons\Docs_KB::TAXONOMY,
28 - 'field' => 'term_id',
29 - 'terms' => $term->term_id,
30 - ],
31 - ],
32 - 'orderby' => 'menu_order',
33 - 'order' => 'ASC',
34 -]);
21 +/* ── Subcategories ── */
22 +$children = [];
23 +if (!$is_tag) {
24 + $children = get_terms([
25 + 'taxonomy' => 'kng_doc_category',
26 + 'parent' => $term->term_id,
27 + 'hide_empty' => true,
28 + ]);
29 + if (is_wp_error($children)) $children = [];
30 +}
35 31
36 -// Get subcategories
37 -$subcategories = get_terms([
38 - 'taxonomy' => \King_Addons\Docs_KB::TAXONOMY,
39 - 'parent' => $term->term_id,
40 - 'hide_empty' => false,
41 - 'orderby' => 'meta_value_num',
42 - 'meta_key' => '_kng_doc_cat_order',
43 -]);
44 -
45 32 get_header();
46 33 ?>
47 34
48 -<div class="kng-docs-page kng-docs-category-page" style="--kng-docs-primary: <?php echo esc_attr($primary_color); ?>;">
35 +<div class="kng-docs-page"
36 + data-kng-theme-mode="<?php echo esc_attr($mode); ?>"
37 + style="--kng-docs-primary:<?php echo esc_attr($primary); ?>; --kng-docs-icon-color:<?php echo esc_attr($primary); ?>;">
38 +
49 39 <div class="kng-docs-container">
50 -
51 - <!-- Breadcrumbs -->
40 +
41 + <!-- ══════════════════════════════════════
42 + BREADCRUMBS
43 + ══════════════════════════════════════ -->
52 44 <nav class="kng-docs-breadcrumbs" aria-label="<?php esc_attr_e('Breadcrumb', 'king-addons'); ?>">
53 - <a href="<?php echo esc_url(get_post_type_archive_link(\King_Addons\Docs_KB::POST_TYPE)); ?>" class="kng-docs-breadcrumb-item">
54 - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
55 - <path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/>
56 - </svg>
45 + <a href="<?php echo esc_url(get_post_type_archive_link('kng_doc')); ?>" class="kng-docs-breadcrumb-item">
46 + <?php echo $ext->get_icon_svg('home'); ?>
57 47 <?php esc_html_e('Docs', 'king-addons'); ?>
58 48 </a>
49 +
59 50 <?php
60 - // Show parent categories if any
61 - $ancestors = get_ancestors($term->term_id, \King_Addons\Docs_KB::TAXONOMY, 'taxonomy');
62 - if (!empty($ancestors)) {
51 + if (!$is_tag && $term->parent) {
52 + $ancestors = get_ancestors($term->term_id, 'kng_doc_category', 'taxonomy');
63 53 $ancestors = array_reverse($ancestors);
64 - foreach ($ancestors as $ancestor_id) {
65 - $ancestor = get_term($ancestor_id);
66 - ?>
67 - <span class="kng-docs-breadcrumb-sep">/</span>
68 - <a href="<?php echo esc_url(get_term_link($ancestor)); ?>" class="kng-docs-breadcrumb-item">
69 - <?php echo esc_html($ancestor->name); ?>
70 - </a>
71 - <?php
54 + foreach ($ancestors as $anc_id) {
55 + $anc = get_term($anc_id, 'kng_doc_category');
56 + if ($anc && !is_wp_error($anc)) {
57 + echo '<span class="kng-docs-breadcrumb-sep">/</span>';
58 + echo '<a href="' . esc_url(get_term_link($anc)) . '" class="kng-docs-breadcrumb-item">' . esc_html($anc->name) . '</a>';
59 + }
72 60 }
73 61 }
74 62 ?>
63 +
75 64 <span class="kng-docs-breadcrumb-sep">/</span>
76 65 <span class="kng-docs-breadcrumb-current"><?php echo esc_html($term->name); ?></span>
77 66 </nav>
78 67
79 - <!-- Category Header -->
80 - <div class="kng-docs-category-header-section">
81 - <?php if (!empty($icon)): ?>
82 - <div class="kng-docs-category-icon-large" style="--icon-color: <?php echo esc_attr($options['category_icon_color'] ?? $primary_color); ?>">
83 - <?php echo \King_Addons\Docs_KB::get_icon_svg($icon); ?>
68 + <!-- ══════════════════════════════════════
69 + CATEGORY / TAG HEADER
70 + ══════════════════════════════════════ -->
71 + <div class="kng-docs-category-header-section kng-docs-reveal">
72 + <div class="kng-docs-category-icon-large">
73 + <?php echo $ext->get_icon_svg($icon_name); ?>
84 74 </div>
85 - <?php endif; ?>
86 75 <h1 class="kng-docs-category-page-title"><?php echo esc_html($term->name); ?></h1>
87 - <?php if (!empty($term->description)): ?>
88 - <p class="kng-docs-category-page-desc"><?php echo esc_html($term->description); ?></p>
76 + <?php if ($term->description) : ?>
77 + <p class="kng-docs-category-page-desc"><?php echo esc_html($term->description); ?></p>
89 78 <?php endif; ?>
90 - <span class="kng-docs-category-page-count">
91 - <?php printf(esc_html(_n('%d article', '%d articles', $term->count, 'king-addons')), $term->count); ?>
92 - </span>
79 + <p class="kng-docs-category-page-count">
80 + <?php printf(
81 + esc_html(_n('%d article', '%d articles', $term->count, 'king-addons')),
82 + $term->count
83 + ); ?>
84 + </p>
93 85 </div>
94 86
95 - <?php if ($search_enabled): ?>
96 - <!-- Search -->
97 - <div class="kng-docs-search kng-docs-search-category">
98 - <div class="kng-docs-search-inner">
99 - <svg class="kng-docs-search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
100 - <circle cx="11" cy="11" r="8"/>
101 - <path d="M21 21l-4.35-4.35"/>
102 - </svg>
103 - <input type="text"
104 - class="kng-docs-search-input"
105 - placeholder="<?php printf(esc_attr__('Search in %s...', 'king-addons'), $term->name); ?>"
106 - data-min-chars="<?php echo esc_attr($options['search_min_chars'] ?? 2); ?>"
107 - data-category="<?php echo esc_attr($term->term_id); ?>"
108 - autocomplete="off">
109 - <div class="kng-docs-search-loader" style="display: none;">
110 - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
111 - <circle cx="12" cy="12" r="10" stroke-dasharray="60" stroke-linecap="round"/>
112 - </svg>
87 + <!-- ══════════════════════════════════════
88 + SUBCATEGORIES
89 + ══════════════════════════════════════ -->
90 + <?php if (!empty($children)) : ?>
91 + <div class="kng-docs-subcategories kng-docs-reveal">
92 + <h2 class="kng-docs-subcategories-title"><?php esc_html_e('Subcategories', 'king-addons'); ?></h2>
93 + <div class="kng-docs-subcategories-grid">
94 + <?php foreach ($children as $child) :
95 + $child_icon = get_term_meta($child->term_id, 'kng_doc_cat_icon', true) ?: 'folder';
96 + ?>
97 + <a href="<?php echo esc_url(get_term_link($child)); ?>" class="kng-docs-subcategory-card">
98 + <span class="kng-docs-subcategory-icon">
99 + <?php echo $ext->get_icon_svg($child_icon); ?>
100 + </span>
101 + <span class="kng-docs-subcategory-content">
102 + <span class="kng-docs-subcategory-name"><?php echo esc_html($child->name); ?></span>
103 + <span class="kng-docs-subcategory-count">
104 + <?php printf(
105 + esc_html(_n('%d article', '%d articles', $child->count, 'king-addons')),
106 + $child->count
107 + ); ?>
108 + </span>
109 + </span>
110 + <svg class="kng-docs-subcategory-arrow" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
111 + <path d="m9 18 6-6-6-6"/>
112 + </svg>
113 + </a>
114 + <?php endforeach; ?>
113 115 </div>
114 116 </div>
115 - <div class="kng-docs-search-results" style="display: none;"></div>
116 - </div>
117 117 <?php endif; ?>
118 118
119 - <?php if (!empty($subcategories)): ?>
120 - <!-- Subcategories -->
121 - <div class="kng-docs-subcategories">
122 - <h3 class="kng-docs-subcategories-title"><?php esc_html_e('Subcategories', 'king-addons'); ?></h3>
123 - <div class="kng-docs-subcategories-grid">
124 - <?php foreach ($subcategories as $subcat):
125 - $sub_icon = get_term_meta($subcat->term_id, '_kng_doc_cat_icon', true);
126 - ?>
127 - <a href="<?php echo esc_url(get_term_link($subcat)); ?>" class="kng-docs-subcategory-card">
128 - <?php if (!empty($sub_icon)): ?>
129 - <div class="kng-docs-subcategory-icon">
130 - <?php echo \King_Addons\Docs_KB::get_icon_svg($sub_icon); ?>
131 - </div>
132 - <?php endif; ?>
133 - <div class="kng-docs-subcategory-content">
134 - <span class="kng-docs-subcategory-name"><?php echo esc_html($subcat->name); ?></span>
135 - <span class="kng-docs-subcategory-count">
136 - <?php printf(esc_html(_n('%d article', '%d articles', $subcat->count, 'king-addons')), $subcat->count); ?>
137 - </span>
138 - </div>
139 - <svg class="kng-docs-subcategory-arrow" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>
140 - </a>
141 - <?php endforeach; ?>
119 + <!-- ══════════════════════════════════════
120 + ARTICLES LIST
121 + ══════════════════════════════════════ -->
122 + <?php if (have_posts()) : ?>
123 + <div class="kng-docs-reveal">
124 + <h2 class="kng-docs-articles-title"><?php esc_html_e('Articles', 'king-addons'); ?></h2>
125 + <ul class="kng-docs-articles">
126 + <?php while (have_posts()) : the_post(); ?>
127 + <li>
128 + <a href="<?php the_permalink(); ?>" class="kng-docs-article-link">
129 + <svg class="kng-docs-article-icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
130 + <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"/>
131 + <path d="M14 2v6h6"/>
132 + <path d="M16 13H8"/>
133 + <path d="M16 17H8"/>
134 + <path d="M10 9H8"/>
135 + </svg>
136 + <span class="kng-docs-article-info">
137 + <span class="kng-docs-article-item-title"><?php the_title(); ?></span>
138 + <?php if (has_excerpt()) : ?>
139 + <span class="kng-docs-article-excerpt"><?php echo esc_html(get_the_excerpt()); ?></span>
140 + <?php endif; ?>
141 + </span>
142 + <span class="kng-docs-article-date">
143 + <?php echo get_the_modified_date(); ?>
144 + </span>
145 + <svg class="kng-docs-article-arrow" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
146 + <path d="m9 18 6-6-6-6"/>
147 + </svg>
148 + </a>
149 + </li>
150 + <?php endwhile; ?>
151 + </ul>
142 152 </div>
143 - </div>
144 - <?php endif; ?>
145 153
146 - <?php if ($docs_query->have_posts()): ?>
147 - <!-- Articles List -->
148 - <div class="kng-docs-articles-list">
149 - <h3 class="kng-docs-articles-title"><?php esc_html_e('Articles', 'king-addons'); ?></h3>
150 - <ul class="kng-docs-articles">
151 - <?php while ($docs_query->have_posts()): $docs_query->the_post(); ?>
152 - <li class="kng-docs-article-item">
153 - <a href="<?php the_permalink(); ?>" class="kng-docs-article-link">
154 - <svg class="kng-docs-article-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
155 - <path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/>
156 - <polyline points="14 2 14 8 20 8"/>
157 - <line x1="16" y1="13" x2="8" y2="13"/>
158 - <line x1="16" y1="17" x2="8" y2="17"/>
159 - <polyline points="10 9 9 9 8 9"/>
160 - </svg>
161 - <div class="kng-docs-article-info">
162 - <span class="kng-docs-article-item-title"><?php the_title(); ?></span>
163 - <?php if (has_excerpt()): ?>
164 - <span class="kng-docs-article-excerpt"><?php echo wp_trim_words(get_the_excerpt(), 15); ?></span>
165 - <?php endif; ?>
166 - </div>
167 - <span class="kng-docs-article-date"><?php echo get_the_modified_date(); ?></span>
168 - <svg class="kng-docs-article-arrow" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>
169 - </a>
170 - </li>
171 - <?php endwhile; ?>
172 - </ul>
173 -
174 - <?php
175 - // Pagination
176 - $total_pages = $docs_query->max_num_pages;
177 - if ($total_pages > 1):
178 - $current_page = max(1, get_query_var('paged'));
179 - ?>
180 - <nav class="kng-docs-pagination">
154 + <!-- Pagination -->
155 + <div class="kng-docs-pagination">
181 156 <?php
182 - echo paginate_links([
183 - 'total' => $total_pages,
184 - 'current' => $current_page,
185 - 'prev_text' => '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 18l-6-6 6-6"/></svg>',
186 - 'next_text' => '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>',
187 - 'type' => 'list',
157 + the_posts_pagination([
158 + 'mid_size' => 2,
159 + 'prev_text' => '<svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>',
160 + 'next_text' => '<svg fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg>',
188 161 ]);
189 162 ?>
190 - </nav>
191 - <?php endif; ?>
192 - </div>
193 - <?php wp_reset_postdata(); ?>
194 -
195 - <?php else: ?>
196 - <div class="kng-docs-empty">
197 - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
198 - <path d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25"/>
199 - </svg>
200 - <h3><?php esc_html_e('No articles found', 'king-addons'); ?></h3>
201 - <p><?php esc_html_e('This category doesn\'t have any articles yet.', 'king-addons'); ?></p>
202 - </div>
163 + </div>
164 + <?php else : ?>
165 + <div class="kng-docs-empty kng-docs-reveal">
166 + <svg fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
167 + <path d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m5.231 13.481L15 17.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v16.5c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Zm3.75 11.625a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z" stroke-linecap="round" stroke-linejoin="round"/>
168 + </svg>
169 + <h3><?php esc_html_e('No articles yet', 'king-addons'); ?></h3>
170 + <p><?php esc_html_e('There are no articles in this category yet.', 'king-addons'); ?></p>
171 + </div>
203 172 <?php endif; ?>
204 173
205 174 </div>
206 175 </div>