There may come a time when you need to create a blank page on your WordPress site that still uses your template’s header, footer and sidebar. For example, if you incorporate your own custom search from google, you will need to specify a landing page where the search results will be displayed.
- WordPress tends to add code to the page the you don’t need or want
- You will need to recreate this file whenever you switch themes or upgrade.
- You cannot easily control where this file is created.
To avoid these problems we can use some built-in functions to display a blank page that uses your template and gives you greater control of the page’s content.
First, create a new file in the root directory of your blog (the directory that contains ‘wp-blog-header.php’). Name it whatever makes sense to you but make sure to give it the ‘.php’ extension. Copy the following into the file you have just created: