PluginProbe
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder / 51.1.49
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder v51.1.49
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 51.1.46 51.1.47 51.1.49 All 37 releases
king-addons / includes / extensions / Docs_KB / templates / taxonomy-docs.php

taxonomy-docs.php in King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder 51.1.49, at includes/extensions/Docs_KB/templates/taxonomy-docs.php

209 lines 9.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Docs Category (Taxonomy) Template
4 *
5 * @package King_Addons
6 */
7
8 if (!defined('ABSPATH')) {
9 exit;
10 }
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';
16
17 // Get category meta
18 $icon = get_term_meta($term->term_id, '_kng_doc_cat_icon', true);
19
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 ]);
35
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 get_header();
46 ?>
47
48 <div class="kng-docs-page kng-docs-category-page" style="--kng-docs-primary: <?php echo esc_attr($primary_color); ?>;">
49 <div class="kng-docs-container">
50
51 <!-- Breadcrumbs -->
52 <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>
57 <?php esc_html_e('Docs', 'king-addons'); ?>
58 </a>
59 <?php
60 // Show parent categories if any
61 $ancestors = get_ancestors($term->term_id, \King_Addons\Docs_KB::TAXONOMY, 'taxonomy');
62 if (!empty($ancestors)) {
63 $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
72 }
73 }
74 ?>
75 <span class="kng-docs-breadcrumb-sep">/</span>
76 <span class="kng-docs-breadcrumb-current"><?php echo esc_html($term->name); ?></span>
77 </nav>
78
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); ?>
84 </div>
85 <?php endif; ?>
86 <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>
89 <?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>
93 </div>
94
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>
113 </div>
114 </div>
115 <div class="kng-docs-search-results" style="display: none;"></div>
116 </div>
117 <?php endif; ?>
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; ?>
142 </div>
143 </div>
144 <?php endif; ?>
145
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">
181 <?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',
188 ]);
189 ?>
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>
203 <?php endif; ?>
204
205 </div>
206 </div>
207
208 <?php get_footer(); ?>
209