Create Blank Page for WordPress Blog Using Your Theme Template

Posted: July 8th, 2009 | Author: | Filed under: php, wordpress | Tags: , | 24 Comments »

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.

You could use WordPress to create a new page, but this has some problems.wordpress logo

  • 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:

Hello!

;
 
<!--?php 
get_footer();
?-->

You can see an example of this page here – http://joe-riggs.com/blog/blank.php.  You can add any valid html or javascript to the section between the php tags and will be displayed.  If you don’t want to display the header, sidebar or footer you can simply comment out or remove that particular line – ie : delete entire  “get_sidebar();” line to remove the sidebar.


24 Comments on “Create Blank Page for WordPress Blog Using Your Theme Template”

  1. 1 Jos said at 9:57 pm on July 21st, 2009:

    Hi Joe,

    Thanks very much for making this clear!
    Just found it on the WP forum.

    Followed all of your steps, did even create the /blank page that’s a good start-off (for later html).

    Then realised, I was lost in first instance (no idea how to attach this page as template).

    Then found this explanation, you might consider to add to above explanation?

    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

    Thanks again.

  2. 2 Laura S. said at 9:42 pm on July 27th, 2009:

    Ok now I’m really confused. I thought the whole point of WP was to enable somebody to easily create pages that are easily editable …?

    I did try to create an easily editable page using “Add Page” but as you said, it included a ton of code from my home page.

    I must be missing something …

  3. 3 Rossie Jordan said at 8:51 am on October 8th, 2009:

    This post is well thought-out and informative.I’m interested,must give a try.

  4. 4 Pascal said at 4:39 am on October 21st, 2009:

    thanks… needed this

  5. 5 Diana said at 7:24 pm on March 15th, 2010:

    I found your post while searching for help in creating a blank page on my blog so that I can easily upload an Amazon aStore. The current settings of my theme prevent the aStore from fully showing up whether I use the inline frame or frameset codes. But unfortunately, I am clueless about even the first step you mention — set up a new file in my blog’s root directory. I have no idea how to do that or even where the root directory is. I’d appreciate your help with this.
    Thanks very much.

  6. 6 footyfiend.com said at 5:06 pm on June 2nd, 2010:

    yo thanks alot! helped me for sure.

  7. 7 Danny said at 10:08 pm on August 13th, 2010:

    Dumb question. I am new to wordpress. There are lot of folders. What exactly is the root directory in my blog? And will this show up in my “page” admin section? Thank you.

  8. 8 Nick said at 6:16 pm on August 20th, 2010:

    Brilliant just what I needed thanks. Worked on my blog.

  9. 9 Max said at 11:21 pm on August 31st, 2010:

    Thank you so much for an easy working guide for setting up custom pages in wordpress. I have been trying other guides and none were as clear as yours. Thanks!

    Max

  10. 10 claim insurance said at 7:55 am on January 26th, 2011:

    Very useful list of templates…thanks for the compilation!

  11. 11 vuitton bags said at 11:11 am on February 11th, 2011:

    I can look for the reference to a site on which there are many articles on this question.

  12. 12 louis vuitton monogram said at 1:15 am on February 12th, 2011:

    In my opinion the theme is rather interesting. I suggest you it to discuss here or in PM.

  13. 13 download Automated Pips for free said at 7:19 am on February 15th, 2011:

    Nice post. Thanks

  14. 14 collin barning said at 2:19 pm on May 17th, 2011:

    If i delete the line get header it lose his stylesheet. I want to have a blank page only with a login and a google search and some widgets.

    can ou help me?

  15. 15 liska said at 10:42 pm on May 26th, 2011:

    Super Site

  16. 16 empower network scam said at 10:03 pm on November 2nd, 2011:

    I wished to thank you for this great read!! I definitely enjoying each little little bit of it I have you bookmarked to take a look at new stuff you put up

  17. 17 Kayleigh Kimbrel said at 11:32 am on November 17th, 2011:

    That is real however you should test your website online pace

  18. 18 mohit mehta said at 6:17 am on January 24th, 2012:

    I’m still learning from you, as I’m making my way to the top as well. I certainly enjoy reading all that is written on your blog.Keep the tips coming. I loved it!

  19. 19 Tyrone said at 11:41 pm on June 8th, 2013:

    This is the perfect site for anybody who hopes to understand this topic.
    You understand so much its almost hard to argue with you (not that I really would
    want to…HaHa). You definitely put a new spin on a topic that has been
    written about for years. Wonderful stuff, just great!

  20. 20 Brain Drda said at 4:08 pm on September 25th, 2013:

    I was excited to uncover this site. I need to to thank you for your time for this particularly wonderful read!! I definitely savored every bit of it and i also have you bookmarked to see new information in your site.

  21. 21 Vito Aievoli said at 6:29 am on September 27th, 2013:

    A motivating discussion is worth comment. I do think that you should write more about this subject matter, it may not be a taboo subject but typically people do not speak about such issues. To the next! Cheers!!

  22. 22 http://www.filker.info/ said at 10:23 pm on November 12th, 2013:

    Write more, hats all I have to say. Literally, it seems as though you relied on thee video to make
    your point. You definitely know what youre talking about, why throw away your intelligence on
    just posting videos to your blog when you could be giving us something enlightening to read?

  23. 23 seo dallas said at 2:26 am on April 5th, 2014:

    When somee one searches for his vital thing,
    therefore he/she wants to be available that in detail, therefore that thing is maintained over here.

  24. 24 edit google plus age said at 3:38 pm on May 31st, 2014:

    Hello there I am so thrilled I found your web site, I really found you by accident, while I was looking on Askjeeve for something else, Nonetheless I am here now and would just like to
    say thanks a lot for a incredible post and a all round exciting blog (I also
    love the theme/design), I don’t have time to read it all at the moment but I have bookmarked it and also
    included your RSS feeds, so when I have time I will be back to read more,
    Please do keep up the fantastic work.