WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Using a static, non-WP page as Front Page (8 posts)

  1. Matt Hancock
    Member
    Posted 4 years ago #

    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.

  2. Peter Boosten
    Member
    Posted 4 years ago #

    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

  3. Matt Hancock
    Member
    Posted 4 years ago #

    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.

  4. Matt Hancock
    Member
    Posted 4 years ago #

    {double post, sorry}

  5. Peter Boosten
    Member
    Posted 4 years ago #

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

    Peter

  6. Peter Boosten
    Member
    Posted 4 years ago #

    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

  7. wizardregis
    Member
    Posted 4 years ago #

    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.

  8. Matt Hancock
    Member
    Posted 4 years ago #

    That did the trick.

    Many thanks. :)

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

Topic Closed

This topic has been closed to new replies.

About this Topic