PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 2.5.2
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v2.5.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 3.5.2 All 199 releases
betterdocs / includes / Shortcodes / CategoryList.php

CategoryList.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 2.5.2, at includes/Shortcodes/CategoryList.php

86 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPDeveloper\BetterDocs\Shortcodes;
4
5 use WPDeveloper\BetterDocs\Core\Shortcode;
6
7 class CategoryList extends Shortcode {
8 public function get_name() {
9 return 'betterdocs_category_list';
10 }
11
12 public function get_style_depends() {
13 return [ 'betterdocs-category-grid-list' ];
14 }
15
16 /**
17 * Summary of default_attributes
18 * @return array
19 */
20 public function default_attributes() {
21 return [
22 'post_type' => 'docs',
23 'category' => 'doc_category',
24 'orderby' => $this->settings->get( 'alphabetically_order_post' ),
25 'order' => $this->settings->get( 'docs_order' ),
26 'masonry' => '',
27 'column' => '',
28 'posts_per_page' => -1,
29 'nested_subcategory' => '',
30 'terms' => '',
31 'terms_orderby' => '',
32 'terms_order' => '',
33 'kb_slug' => '',
34 'multiple_knowledge_base' => false,
35 'title_tag' => 'h2'
36 ];
37 }
38
39 public function view_params() {
40 $terms_query = $this->query->terms_query( [
41 'multiple_kb' => $this->attributes['multiple_knowledge_base'],
42 'kb_slug' => $this->attributes['kb_slug'],
43 'terms' => $this->attributes['terms'],
44 'order' => $this->attributes['terms_order'],
45 'orderby' => $this->attributes['terms_orderby'],
46 'nested_subcategory' => (bool) $this->attributes['nested_subcategory']
47 ] );
48
49 $docs_query = [
50 'orderby' => $this->attributes['orderby'],
51 'order' => $this->attributes['order'],
52 'posts_per_page' => $this->attributes['posts_per_page']
53 ];
54
55 return [
56 'wrapper_attr' => ['class' => ['betterdocs-category-list-wrapper']],
57 'inner_wrapper_attr' => ['class' => ['betterdocs-category-list-inner-wrapper']],
58 'is_edit_mode' => false,
59 'widget' => $this,
60 'layout' => 'default',
61
62 'default_multiple_kb' => false,
63 'terms_query_args' => $terms_query,
64 'docs_query_args' => $docs_query,
65 'widget_type' => 'category-grid',
66
67 'show_header' => true,
68 'show_list' => true,
69 'list_icon' => true,
70
71 'show_button' => false,
72
73 'show_count' => false,
74 'count_prefix' => '',
75 'count_suffix_singular' => '',
76 'count_suffix' => '',
77 'show_title' => true,
78 'show_icon' => false
79 ];
80 }
81
82 public function render( $atts, $content = null ) {
83 $this->views( 'layouts/base' );
84 }
85 }
86