PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.8.9
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.8.9
4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 All 200 releases
← All changes | includes/Shortcodes/CategoryGrid.php +7 -38 4.6.13.8.9 View file →
@@ -1,13 +1,8 @@
1 1 <?php
2 -// phpcs:disable WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- shortcode exposes user-driven exclusion attribute.
2 +
3 3 namespace WPDeveloper\BetterDocs\Shortcodes;
4 4
5 -if ( ! defined( 'ABSPATH' ) ) {
6 - exit;
7 -}
8 -
9 -
10 5 use WPDeveloper\BetterDocs\Utils\Helper;
11 6 use WPDeveloper\BetterDocs\Core\Shortcode;
12 7
13 8 class CategoryGrid extends Shortcode {
@@ -68,11 +63,9 @@
68 63 'category_title_link' => false,
69 64 'layout_type' => '',
70 65 'list_icon_url' => '',
71 66 'list_icon_name' => 'list',
72 - 'show_list_icon' => true,
73 - 'sidebar_layout' => '',
74 - 'wrapper_class' => []
67 + 'sidebar_layout' => ''
75 68 ];
76 69 }
77 70
78 71 public function generate_attributes() {
@@ -113,9 +106,8 @@
113 106 $attributes['class'][] = 'single-kb';
114 107 }
115 108 }
116 109
117 -
118 110 return $attributes;
119 111 }
120 112
121 113 public function header_layout_sequence( $sequence, $layout, $widget_type, $args ) {
@@ -184,31 +176,10 @@
184 176 if ( $this->attributes['multiple_knowledge_base'] && ( ! empty( $this->attributes['kb_slug'] ) ) && ( ! betterdocs()->helper->is_templates() ) ) {
185 177 $inner_wrapper_attr['data-mkb-slug'] = $this->attributes['kb_slug'];
186 178 }
187 179
188 - // Prepare wrapper attributes with custom classes
189 - $wrapper_attr_classes = [ 'betterdocs-category-grid-wrapper' ];
190 -
191 - // Add custom wrapper classes if provided
192 - if ( $this->isset( 'wrapper_class' ) ) {
193 - $wrapper_classes = $this->attributes['wrapper_class'];
194 -
195 - // Handle both array and string formats
196 - if ( is_string( $wrapper_classes ) ) {
197 - // Split by comma or space and clean up
198 - $wrapper_classes = preg_split( '/[,\s]+/', $wrapper_classes );
199 - $wrapper_classes = array_filter( array_map( 'trim', $wrapper_classes ) );
200 - } elseif ( is_array( $wrapper_classes ) ) {
201 - $wrapper_classes = array_filter( $wrapper_classes );
202 - }
203 -
204 - if ( ! empty( $wrapper_classes ) ) {
205 - $wrapper_attr_classes = array_merge( $wrapper_attr_classes, $wrapper_classes );
206 - }
207 - }
208 -
209 180 return [
210 - 'wrapper_attr' => [ 'class' => $wrapper_attr_classes ],
181 + 'wrapper_attr' => [ 'class' => [ 'betterdocs-category-grid-wrapper' ] ],
211 182 'inner_wrapper_attr' => $inner_wrapper_attr,
212 183 'layout' => 'default',
213 184 'widget_type' => 'category-grid',
214 185 'terms_query_args' => $terms_query,
@@ -213,9 +184,9 @@
213 184 'widget_type' => 'category-grid',
214 185 'terms_query_args' => $terms_query,
215 186 'docs_query_args' => $docs_query,
216 187 'nested_docs_query_args' => $docs_query,
217 - 'list_icon_name' => ($this->attributes['list_icon_name'] ?? 'list') == 'list' ? 'list' : [ 'value' => $this->attributes['list_icon_name'] ?? 'list' ],
188 + 'list_icon_name' => $this->attributes['list_icon_name'] == 'list' ? 'list' : [ 'value' => $this->attributes['list_icon_name'] ],
218 189 'show_header' => true,
219 190 'show_list' => true,
220 191 'show_title' => true,
221 192 'show_button' => $show_button,
@@ -221,14 +192,12 @@
221 192 'show_button' => $show_button,
222 193 'button_text' => $button_text,
223 194 'show_button_icon' => true,
224 195 'button_icon_position' => true,
225 - 'title_tag' => $this->attributes['title_tag'] ?? 'h2',
226 196 'button_icon' => true,
227 197 'category_title_link' => $category_title_link,
228 - 'layout_type' => $this->attributes['layout_type'] ?? '',
229 - 'list_icon_url' => $this->attributes['list_icon_url'] ?? '',
230 - 'show_list_icon' => $this->attributes['show_list_icon'] ?? true,
231 - 'sidebar_layout' => $this->attributes['sidebar_layout'] ?? ''
198 + 'layout_type' => $this->attributes['layout_type'],
199 + 'list_icon_url' => $this->attributes['list_icon_url'],
200 + 'sidebar_layout' => $this->attributes['sidebar_layout']
232 201 ];
233 202 }
234 203 }