@@ -62,11 +62,11 @@ public function __construct() {
6262 }
6363
6464 add_action ( 'pre_get_posts ' , [ $ this , 'pre_get_posts ' ] );
65- add_filter ( 'template_include ' , [ $ this , 'template_include ' ] );
66-
6765 add_filter ( 'the_title ' , [ $ this , 'the_title ' ] );
6866 add_filter ( 'the_content ' , [ $ this , 'the_content ' ] );
6967 add_filter ( 'get_the_excerpt ' , [ $ this , 'the_content ' ] );
68+ add_filter ( 'home_template_hierarchy ' , [ $ this , 'use_page_template_hierarchy ' ] );
69+ add_filter ( 'frontpage_template_hierarchy ' , [ $ this , 'use_page_template_hierarchy ' ] );
7070 add_filter ( 'post_thumbnail_html ' , '__return_empty_string ' );
7171 }
7272
@@ -129,12 +129,27 @@ public function pre_get_posts( $query ) {
129129 }
130130 }
131131
132+
133+ /**
134+ * Force page template types.
135+ *
136+ * @since 1.6.12
137+ * @param array $templates A list of template candidates, in descending order of priority.
138+ *
139+ * @return array
140+ */
141+ public function use_page_template_hierarchy ( $ templates ) {
142+
143+ return [ 'page.php ' , 'single.php ' , 'index.php ' ];
144+ }
132145 /**
133146 * Limit the page templates to singular pages only
134147 *
148+ * @deprecated 1.6.11
135149 * @return string
136150 */
137- public function template_include () {
151+ public function template_include ( ) {
152+ _deprecated_function ( __METHOD__ , 'WeForms 1.6.11 ' );
138153 return locate_template ( [ 'page.php ' , 'single.php ' , 'index.php ' ] );
139154 }
140155}
0 commit comments