| @@ -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' ] ); |
| @@ -41,34 +31,8 @@ | ||
| 41 | 31 | if ( ! $this->is_fse_theme ) { |
| 42 | 32 | add_filter( 'archive_template', [ $this, 'archive_template' ] ); |
| 43 | 33 | add_filter( 'single_template', [ $this, 'single_template' ] ); |
| 44 | 34 | } |
| 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 ); | |
| 71 | 35 | } |
| 72 | 36 | |
| 73 | 37 | /** |
| 74 | 38 | * Render Thrive Header Markup |