PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.3.2
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.3.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 / views / admin / docs-ui / grid.php

grid.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 3.3.2, at views/admin/docs-ui/grid.php

81 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $terms_object = [
3 'taxonomy' => 'doc_category',
4 'orderby' => 'meta_value_num',
5 'meta_key' => 'doc_category_order',
6 'order' => 'ASC',
7 'hide_empty' => false
8 ];
9
10 $kb = '';
11 if ( isset( $_GET['knowledgebase'] ) && $_GET['knowledgebase'] !== 'all' ) {
12 $kb = $_GET['knowledgebase'];
13
14 $terms_object['meta_query'] = [
15 [
16 'key' => 'doc_category_knowledge_base',
17 'value' => $_GET['knowledgebase'],
18 'compare' => 'LIKE'
19 ]
20 ];
21 }
22
23 $terms = get_terms( $terms_object );
24
25 global $wpdb;
26
27 $_post__not_in_query = $wpdb->prepare(
28 "SELECT ID as post_id from $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID NOT IN ( SELECT object_id as post_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN ( SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE taxonomy = %s ) )",
29 'docs',
30 'doc_category'
31 );
32
33 $_post__not_in = $wpdb->get_col( $_post__not_in_query );
34 ?>
35
36 <div class="betterdocs-tab-content" id="betterdocs-tab-2">
37 <div class="betterdocs-listing-content">
38 <?php
39 if ( ! empty( $terms ) ) {
40 foreach ( $terms as $term ) {
41 $query = betterdocs()->query->get_posts( [
42 'post_type' => 'docs_any',
43 'multiple_kb' => ! empty( $kb ),
44 'term_id' => $term->term_id,
45 'term_slug' => $term->slug,
46 'posts_per_page' => -1,
47 'kb_slug' => $kb,
48 'orderby' => 'betterdocs_order'
49 ] );
50
51 $view_object->get( 'admin/docs-ui/grid-partials/single', [
52 'query' => $query,
53 'term' => $term
54 ] );
55 }
56 }
57
58 if( ! empty( $_post__not_in ) ) {
59 $_uncategorized_docs_query = new \WP_Query([
60 'post_type' => 'docs',
61 'post_status' => 'any',
62 'post__in' => $_post__not_in
63 ]);
64
65 $_term = new stdClass;
66 $_term->name = __('Uncategorized', 'betterdocs');
67 $_term->term_id = '';
68
69 $view_object->get( 'admin/docs-ui/grid-partials/single', [
70 'query' => $_uncategorized_docs_query,
71 'term' => $_term
72 ] );
73 }
74
75 if( empty( $_post__not_in ) && empty( $terms ) ) {
76 $view_object->get( 'admin/docs-ui/grid-partials/no-category-item' );
77 }
78 ?>
79 </div>
80 </div>
81