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/FrontEnd/TemplateLoader.php +33 -1 4.5.54.9.2 View file →
@@ -28,9 +28,15 @@
28 28 public function init() {
29 29 $this->is_fse_theme = $this->is_fse_theme();
30 30
31 31 if ( $this->is_fse_theme ) {
32 - // @todo: for 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 );
33 39 }
34 40
35 41 if ( ! $this->is_fse_theme ) {
36 42 add_filter( 'archive_template', [ $this, 'archive_template' ] );
@@ -35,8 +41,34 @@
35 41 if ( ! $this->is_fse_theme ) {
36 42 add_filter( 'archive_template', [ $this, 'archive_template' ] );
37 43 add_filter( 'single_template', [ $this, 'single_template' ] );
38 44 }
45 + }
46 +
47 + /**
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 );
39 71 }
40 72
41 73 /**
42 74 * Render Thrive Header Markup