PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.4.2
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.4.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 3.4.2, at includes/Shortcodes/CategoryList.php

90 lines 3.1 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 public function get_script_depends() {
17 return ['betterdocs-category-grid'];
18 }
19
20 /**
21 * Summary of default_attributes
22 * @return array
23 */
24 public function default_attributes() {
25 return [
26 'post_type' => 'docs',
27 'category' => 'doc_category',
28 'orderby' => $this->settings->get( 'alphabetically_order_post' ),
29 'order' => $this->settings->get( 'docs_order' ),
30 'masonry' => '',
31 'column' => '',
32 'posts_per_page' => -1,
33 'nested_subcategory' => '',
34 'terms' => '',
35 'terms_orderby' => '',
36 'terms_order' => '',
37 'kb_slug' => '',
38 'multiple_knowledge_base' => false,
39 'title_tag' => 'h2'
40 ];
41 }
42
43 public function view_params() {
44 $terms_query = $this->query->terms_query( [
45 'multiple_kb' => $this->attributes['multiple_knowledge_base'],
46 'kb_slug' => $this->attributes['kb_slug'],
47 'terms' => $this->attributes['terms'],
48 'order' => $this->attributes['terms_order'],
49 'orderby' => $this->attributes['terms_orderby'],
50 'nested_subcategory' => (bool) $this->attributes['nested_subcategory']
51 ] );
52
53 $docs_query = [
54 'orderby' => $this->attributes['orderby'],
55 'order' => $this->attributes['order'],
56 'posts_per_page' => $this->attributes['posts_per_page']
57 ];
58
59 return [
60 'wrapper_attr' => ['class' => ['betterdocs-category-list-wrapper']],
61 'inner_wrapper_attr' => ['class' => ['betterdocs-category-list-inner-wrapper']],
62 'is_edit_mode' => false,
63 'widget' => $this,
64 'layout' => 'default',
65
66 'default_multiple_kb' => false,
67 'terms_query_args' => $terms_query,
68 'docs_query_args' => $docs_query,
69 'widget_type' => 'category-grid',
70
71 'show_header' => true,
72 'show_list' => true,
73 'list_icon' => true,
74
75 'show_button' => false,
76
77 'show_count' => false,
78 'count_prefix' => '',
79 'count_suffix_singular' => '',
80 'count_suffix' => '',
81 'show_title' => true,
82 'show_icon' => false
83 ];
84 }
85
86 public function render( $atts, $content = null ) {
87 $this->views( 'layouts/base' );
88 }
89 }
90