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/FrontEnd/TemplateLoader.php +5 -48 4.9.23.8.9 View file →
@@ -1,12 +1,8 @@
1 1 <?php
2 +
2 3 namespace WPDeveloper\BetterDocs\FrontEnd;
3 4
4 -if ( ! defined( 'ABSPATH' ) ) {
5 - exit;
6 -}
7 -
8 -
9 5 use WPDeveloper\BetterDocs\Utils\Base;
10 6 use WPDeveloper\BetterDocs\Utils\Views;
11 7 use WPDeveloper\BetterDocs\Utils\Database;
12 8 use WPDeveloper\BetterDocs\Dependencies\DI\Container;
@@ -28,15 +24,9 @@
28 24 public function init() {
29 25 $this->is_fse_theme = $this->is_fse_theme();
30 26
31 27 if ( $this->is_fse_theme ) {
32 - // Block themes have no PHP template-hierarchy hook for the glossaries
33 - // (encyclopedia) taxonomy, so single glossary entries fall through to the
34 - // theme's default block template and render the generic docs/archive
35 - // output instead of the BetterDocs glossary template (fbs-79870). Force
36 - // the glossary template via template_include, which runs after
37 - // locate_block_template() so it wins over the block-template fallback.
38 - add_filter( 'template_include', [ $this, 'fse_glossaries_template' ], 99 );
28 + // @todo: for FSE theme
39 29 }
40 30
41 31 if ( ! $this->is_fse_theme ) {
42 32 add_filter( 'archive_template', [ $this, 'archive_template' ] );
@@ -44,34 +34,8 @@
44 34 }
45 35 }
46 36
47 37 /**
48 - * Load the BetterDocs glossary template for single glossary (encyclopedia)
49 - * taxonomy pages under block (FSE) themes. Mirrors the glossaries branch of
50 - * archive_template() used for classic themes. Runs late on template_include
51 - * so it overrides the block-template fallback that would otherwise render the
52 - * generic docs archive. (fbs-79870)
53 - *
54 - * @param string $template The template path resolved so far.
55 - * @return string
56 - */
57 - public function fse_glossaries_template( $template ) {
58 - if ( ! is_tax( 'glossaries' ) ) {
59 - return $template;
60 - }
61 -
62 - $_default_template = 'templates/single/layout-1';
63 - $layout = 'templates/single/layout-7';
64 - $eligible_template = $this->views->path( $layout, $_default_template );
65 -
66 - if ( file_exists( $eligible_template ) ) {
67 - $template = $eligible_template;
68 - }
69 -
70 - return apply_filters( 'betterdocs_archives_template', $template, $layout, $_default_template, $this->views );
71 - }
72 -
73 - /**
74 38 * Render Thrive Header Markup
75 39 *
76 40 * Outputs the header section and starts the main container for the page content.
77 41 *
@@ -105,15 +69,8 @@
105 69 * @param string $template The original template.
106 70 * @return string The archive template.
107 71 */
108 72 public function archive_template( $template ) {
109 - if( is_tax('doc_category') ) {
110 - // If 'archive-doc_category.php' exists in the theme, return it
111 - $theme_template = locate_template( 'archive-doc_category.php' );
112 - if ( $theme_template ) {
113 - return $theme_template;
114 - }
115 - }
116 73
117 74 if ( is_tax( 'glossaries' ) ) {
118 75 // Use a custom taxonomy template for your custom taxonomy
119 76
@@ -128,9 +85,9 @@
128 85
129 86 return apply_filters( 'betterdocs_archives_template', $template, $layout, $_default_template, $this->views );
130 87 }
131 88
132 - if ( get_post_type() !== 'docs' && ! is_tax('doc_category') && ! is_tax( 'doc_tag' ) && ! is_tax( 'knowledge_base' ) ) {
89 + if ( get_post_type() !== 'docs' ) {
133 90 return $template;
134 91 }
135 92
136 93 if ( is_embed() ) {
@@ -143,12 +100,12 @@
143 100
144 101 $_default_template = 'templates/archives/layout-1';
145 102 $layout = $this->database->get_theme_mod( 'betterdocs_docs_layout_select', 'layout-7' );
146 103 $_template = 'templates/archives/' . $layout;
147 -
104 +
148 105 if ( is_tax( 'doc_category' ) ) {
149 106 $category_layout = $this->database->get_theme_mod( 'betterdocs_archive_layout_select', 'layout-7' );
150 - if ( $category_layout == 'layout-7' || $category_layout == 'layout-8' ) {
107 + if ( $category_layout == 'layout-7' ) {
151 108 $_template = 'templates/archives/categories/' . $category_layout;
152 109 } else {
153 110 $_template = 'templates/taxonomy-doc_category';
154 111 }