template_include

Author: WP Sites

Date: January 15, 2020 

Category: Theme development, Tips and tricks, Tutorials

Using the template_include function included in WordPress, paste this PHP code at the end of your child themes functions.php file and modify accordingly.

add_filter( 'template_include', 'single_page_template', 99 ); function single_page_template( $template ) { if ( is_singular('page') ) { $new_template = locate_template( array( 'single.php' ) ); if ( '' != $new_template ) { return $new_template ; } } return $template; }

The function loads the template named single.php on all single pages. The template named single.php can be placed anywhere in your child theme folder. In this case, its

Click here to read the full article in a new tab!


template_include 1


template_include 2

Servebolt is next level high performance hosting.

While others try to add more components to their hosting to make it go faster, we decided to build our hosting cloud fast from the ground up. We did so by stripping out everything we knew was deadweight.