Skip to content

Commit c4a6ff7

Browse files
committed
Fixes issue-150
1 parent c11eba4 commit c4a6ff7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

includes/class-form-preview.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ public function pre_get_posts( $query ) {
131131

132132

133133
/**
134-
* Force page template types.
134+
* Use page template types.
135+
*
136+
* Instead of just locating one page template with the highest priority,
137+
* we are going to look for any page template that matches 'page.php', 'single.php' or 'index.php'.
138+
* This resolves issues with Block Based themes that do not have a index.php.
135139
*
136140
* @since 1.6.12
137141
* @param array $templates The list of templates in descending order of priority from WordPress.
@@ -140,7 +144,7 @@ public function pre_get_posts( $query ) {
140144
*/
141145
public function use_page_template_hierarchy( $templates ) {
142146

143-
return [ 'page.php', 'single.php', 'index.php' ];
147+
return array( 'page.php', 'single.php', 'index.php' );
144148
}
145149
/**
146150
* Limit the page templates to singular pages only
@@ -150,6 +154,6 @@ public function use_page_template_hierarchy( $templates ) {
150154
*/
151155
public function template_include( ) {
152156
_deprecated_function( __METHOD__, 'WeForms 1.6.11' );
153-
return locate_template( [ 'page.php', 'single.php', 'index.php' ] );
157+
return locate_template( array( 'page.php', 'single.php', 'index.php' ) );
154158
}
155159
}

0 commit comments

Comments
 (0)