Skip to content

Commit

Permalink
fix: other tempaltes than the ones defined by the theme not being ava…
Browse files Browse the repository at this point in the history
…ilable
  • Loading branch information
abaicus committed Jan 20, 2023
1 parent 51cd532 commit 2041ddd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion inc/compatibility/fse.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,20 @@ public function filter_templates( $query_result, $query, $template_type ) {
}

foreach ( $query_result as $key => $template ) {
$enabled = $this->is_template_enabled( $template->slug );
// Skip if this is not defined by the theme itself. Allow all other templates to fall through.
if ( ! in_array( $template->slug, array_keys( $this->templates ) ) ) {
continue;
}

$enabled = $this->is_template_enabled( $template->slug );
$conditions = $this->get_template_conditions();


// Still need to load all templates in admin.
if ( ! is_admin() ) {
if ( ! isset( $conditions[ $template->slug ] ) || $conditions[ $template->slug ] !== true ) {
$enabled = false;
}
// Page should not affect the front page.
if ( $template->slug === 'page' && $this->is_front_page() ) {
$enabled = false;
Expand Down

0 comments on commit 2041ddd

Please sign in to comment.