Support » Fixing WordPress » Lesson: How to make a static page your “home” page

  • Alright, I figured I’d make this a lesson post since I’ve seen a few people wanting to do this. This are the steps that need to be taken if you want to have a wordpress “page” your home page before people can see your blog.

    1. First step is to create a plugin with Ryan’s plugin:

    Plugin Name: Page to Front
    Version: 1.0
    Plugin URI:
    Description: Choose a page from the DB to display as the front page of your weblog.
    Author: Ryan Boren
    Author URI:

    // Put the id of the page you want to display here. To find the page id,
    // go to Manage->Pages in the admin UI and look at the ID column.
    $ptf_front_page = 1;

    function ptf_front_page($query_string) {
    global $ptf_front_page;

    $query = new WP_Query();

    if ($query->is_home) {
    $query_string = add_query_arg(‘page_id’, $ptf_front_page, $query_string);

    return $query_string;

    add_filter(‘query_string’, ‘ptf_front_page’);

    You can name it something like pagetofront.php or whatever you want really.

    2 . Next, create the page that you want people to see when they first come visit your site. You could make it as simple as just having text with your theme look, or you could create a whole new template for your home page and then just create it as a page.

    If you’re making a new template, don’t forget to add the following to the top of your php file:

    Template Name: Home

    3. Note the number that the page is given when you create the page, and edit the plugin with the page that you want as your new “home page.”

    4. Next up, you’ll need to edit your permalink structure so that you’ll be able to get from your home page to the rest of your blog. Without setting up the permalink structure, I believe that you’ll have no way of getting back to your blog since the plugin will keep redirecting you back to the home page.

    You’ll want your permalink structure to look something like this:

    WordPress Address:
    Blog Address:
    Permalink Structure: /blog/%year%/%monthnum%/%day%/%postname%/

    That should be all that you need to do. You’ll now be able to have a static home page which is part of wordpress.

    All of this is assuming that you have wordpress installed in your root directory instead of a folder. You could do this if you had wp installed in a folder, but then your home page would be located at with your blog then at

    Hope this helps!

Viewing 15 replies - 1 through 15 (of 43 total)
  • Thanks!

    there’s something about this in the codex. feel free to update it:

    heh it must’ve been recently added.

    Yep. About a week ago. That’s the way of it. I’d compare notes to see if they match, and if they don’t, let us know.

    And there is nothing wrong with your lesson here that I can tell. Even if it is in the codex, we need to talk about these issues here. The whole reason I started these Lessons were because the Codex was down but I happened to have some of the pages saved to my computer. Not everyone looks to the Codex first because it is still “new”, so it doesn’t matter.

    And by posting it here, you get a chance to learn even more about the techniques and how others do it.

    Keep up the great work and we need more of these!

    If you have a question about posting a Lesson, or you want to see some of the suggestions for Lessons, check out this thread:
    Lessons: Getting Started with Lessons

    Here is my solution :

    1. Copy page.php -> home.php
    2. Add query_posts(“page_id=2”); (where page_id is your page) before the Loop
    3. Copy index.php -> news.php and add at the top
    Template Name: News
    And add query_posts(“showposts=10”); before the Loop
    4. Make a page named News and assign template News to it

    All works fine, i think. At least for me. And all pages in sidebar lists automatically.
    Basicaly it’s the same solution as above, but there is no need to change permalinks and adresses.

    Is there any bugs or minuses ?

    yea, I think your way’ll work too, it’s just that using the plugin allows for less editting of your index.php file, although your way doesn’t require a change in permalinks.

    Docker is your solution something taht is done without Ryan’s plugin?

    docker did it without the plugin, but he also had to manually add code to his files. If you’re comfortable with that, then you don’t need to use Ryan’s plugin.

    My solution is simpler still and prevents this rampant hackery. Run your front page off home.php. No if / else malarkey. Switching to index for the blog by default . No need to hack your index. Get this – no pages necessary or accordingly no template association and NO PLUGIN NEEDED.

    Pardon my ignorance, I’m new to all of this and THOROUGHLY confused at this point.

    I installed Ryan’s plug-in. However I can not get to the blog. Not only that, but the archives pages show a shortened sidebar. Site is here:

    Root what do you mean by “run your front page”? Are you saying rename index.php to home.php?? Where does the new page I created to be the front page fall into that setup?

    It is a little used fact that when WP loads the very first file it tries is home.php . Consult the sages at the Oracle of Codex if you need more details. What does that mean ? You can create a home page by simply copying index.php as home.php. It will then be your front page. Then you can hack it to death . In your case that will involve simply deleting everything you dont want . If you want an early preview of a home / index switch from 3>2 cols you can just peek at my new template (very under construction) Aphrodite . You saw it here first. 🙂

    Ok, the point really was to :

    1. Make a static page your home page, and possibility to change it content from admin panel.
    2. Get a fancy link to back to your blog with all your posts, like you get it usually without hacks or plugins. This link have to be in pages list automatically.

    Of course i used home.php functionality in my hack. But sorry for all – my hack not works properly 🙁 Try to reach next page if you have more than 10 posts and you will get 404 error.

    lawtai have a good solution, but i don’t know why it not works for me (i always have 404 error when try to get my posts, and even if it’s working – i have to manually add link to blog to menu. It’s simple but i’m lazy :).

    Now i’m trying the way with plugins – Ryan’s Page to Front, and Owen’s Redirectify.

    Will see….

    Well mine seems to be running fine.

    Root if you have the time, I could use some help with this. Be forewarned I’m new to coding – I hack my way thru most of the time. yogaboat at hotmail dot com.



    But using Ryans plugin, is there an EASY way of getting to the blog (in the root folder).

    At the moment I can only do it through – but it’s not a sure fire answer – I’d ideally like

Viewing 15 replies - 1 through 15 (of 43 total)
  • The topic ‘Lesson: How to make a static page your “home” page’ is closed to new replies.