PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.2
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.2
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/CategoryList.php +83 -70 3.4.04.9.2 View file →
@@ -4,86 +4,99 @@
4 4
5 5 use WPDeveloper\BetterDocs\Core\Shortcode;
6 6
7 7 class CategoryList extends Shortcode {
8 - public function get_name() {
9 - return 'betterdocs_category_list';
10 - }
8 + public function get_name() {
9 + return 'betterdocs_category_list';
10 + }
11 11
12 - public function get_style_depends() {
13 - return [ 'betterdocs-category-grid-list' ];
14 - }
12 + public function get_style_depends() {
13 + return [ 'betterdocs-category-grid-list' ];
14 + }
15 15
16 - public function get_script_depends() {
17 - return ['betterdocs-category-grid'];
18 - }
16 + public function get_script_depends() {
17 + return [ 'betterdocs-category-grid' ];
18 + }
19 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 - }
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 + 'layout_type' => '',
41 + 'list_icon_url' => '',
42 + 'sidebar_layout' => '',
43 + 'list_icon_name' => '',
44 + 'lazy_load' => false
45 + ];
46 + }
42 47
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 - ] );
48 + public function view_params() {
49 + $terms_query = $this->query->terms_query(
50 + [
51 + 'multiple_kb' => ( $this->attributes['multiple_knowledge_base'] && ! empty( $this->attributes['kb_slug'] ) ) ? true : false,
52 + 'kb_slug' => $this->attributes['kb_slug'],
53 + 'terms' => $this->attributes['terms'],
54 + 'order' => $this->attributes['terms_order'],
55 + 'orderby' => $this->attributes['terms_orderby'],
56 + 'nested_subcategory' => (bool) $this->attributes['nested_subcategory']
57 + ]
58 + );
52 59
53 - $docs_query = [
54 - 'orderby' => $this->attributes['orderby'],
55 - 'order' => $this->attributes['order'],
56 - 'posts_per_page' => $this->attributes['posts_per_page']
57 - ];
60 + $docs_query = [
61 + 'orderby' => $this->attributes['orderby'],
62 + 'order' => $this->attributes['order'],
63 + 'posts_per_page' => $this->attributes['posts_per_page']
64 + ];
58 65
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',
66 + return [
67 + 'wrapper_attr' => [ 'class' => [ 'betterdocs-category-list-wrapper' ] ],
68 + 'inner_wrapper_attr' => [ 'class' => [ 'betterdocs-category-list-inner-wrapper' ] ],
69 + 'is_edit_mode' => false,
70 + 'widget' => $this,
71 + 'layout' => 'default',
65 72
66 - 'default_multiple_kb' => false,
67 - 'terms_query_args' => $terms_query,
68 - 'docs_query_args' => $docs_query,
69 - 'widget_type' => 'category-grid',
73 + 'default_multiple_kb' => false,
74 + 'terms_query_args' => $terms_query,
75 + 'docs_query_args' => $docs_query,
76 + 'widget_type' => 'category-grid',
70 77
71 - 'show_header' => true,
72 - 'show_list' => true,
73 - 'list_icon' => true,
78 + 'show_header' => true,
79 + 'show_list' => true,
80 + 'list_icon' => true,
74 81
75 - 'show_button' => false,
82 + 'show_button' => false,
76 83
77 - 'show_count' => false,
78 - 'count_prefix' => '',
79 - 'count_suffix_singular' => '',
80 - 'count_suffix' => '',
81 - 'show_title' => true,
82 - 'show_icon' => false
83 - ];
84 - }
84 + 'show_count' => false,
85 + 'count_prefix' => '',
86 + 'count_suffix_singular' => '',
87 + 'count_suffix' => '',
88 + 'show_title' => true,
89 + 'show_icon' => false,
90 + 'layout_type' => $this->attributes['layout_type'],
91 + 'list_icon_url' => $this->attributes['list_icon_url'],
92 + 'sidebar_layout' => $this->attributes['sidebar_layout'],
93 + 'list_icon_name' => $this->attributes['list_icon_name'],
94 + 'title_tag' => $this->attributes['title_tag'],
95 + 'lazy_load' => ! empty( $this->attributes['lazy_load'] )
96 + ];
97 + }
85 98
86 - public function render( $atts, $content = null ) {
87 - $this->views( 'layouts/base' );
88 - }
99 + public function render( $atts, $content = null ) {
100 + $this->views( 'layouts/base' );
101 + }
89 102 }