Support » Themes and Templates » Using a static, non-WP page as Front Page

  • Resolved Matt Hancock

    (@matthancocknz)


    I have a file that I coded myself to be used as the front page of my WP-powered website.

    How can I use this page as the front page and not have it affect the rest of my WP theme?

    I did try renaming it to index.php and dropping it into the theme folder. While that worked, subsequent pages used index.php until I resorted to using posts under a different category to bypass index.php – not the best way.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Try home.php

    if that doesn’t work, modify your page to be a page template, assign it to a page and let this page be your static home page (settings).

    Peter

    I renamed it to home.php, but when I try to visit a page, it now gives me a blank screen.

    I can’t really modify the page to be a template because there’s specific coding on it that doesn’t come out when I try to publish a page as such.

    {double post, sorry}

    You would have to restore your original index.php when using home.php

    Peter

    I think you might have a wrong picture about page templates: there’s really nothing you can’t do with page templates, even write your own code in it (except making coffee perhaps).

    Peter

    Yes, Peter is right. What you need to do is go into your custom page and add:

    <?php
    /*
    Template Name: Something
    */
    ?>

    at the top, and place it in your theme folder. Then you create a new page in WordPress, and in the right sidebar select “Something” as a template. This means that the page with the above code will load when someone enters the WordPress page assigned to this template.

    Then you go into Settings > Reading and under Front Page Display select “A static page” and in “Front page” select the “Something” page.

    This will make anyone who open your website to see “Something” page as the front page.

    And you will probably want to use the default index.php page for normal viewing of posts and pages.

    That did the trick.

    Many thanks. 🙂

    EDIT: Wow, I refresh the page to find more awesome advice. Thanks for that additional information about templates. 😀

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Using a static, non-WP page as Front Page’ is closed to new replies.