WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] home.php disables index.php?

[Resolved] home.php disables index.php?

  • This is me being thick, but I tried my best to understand how to set up a static page (a “front page”) while still keeping a blog “behind” it. Since index.php is the main blog site, I set the static front page up as foo.com/home.php, and put a link on foo.com/home.php to the “front page of the blog,” at foo.com/?index.php.

    But the link from foo.com/home.php to foo.com/?index.php just re-loads my foo.com/home.php page. Somehow the index.php just sends the browser back to home.php, and there’s an eternal loop.

    What do I need to do to “salvage” index.php and turn it into the front page of my blog again?

Viewing 4 replies - 1 through 4 (of 4 total)
  • do you mean this

    <?php
    /**
     * Front to the WordPress application. This file doesn't do anything, but loads
     * wp-blog-header.php which does and tells WordPress to load the theme.
     *
     * @package WordPress
     */
    
    /**
     * Tells WordPress to load the WordPress theme and output it.
     *
     * @var bool
     */
    define('WP_USE_THEMES', true);
    
    /** Loads the WordPress Environment and Template */
    require('./wp-blog-header.php');
    ?>

    thats what index.php is ? or teh index.php of the theme?

    Completely wrong approach. And complicated. Both.

    You go into Settings > Reading and select an existing Page as your home/front page and select another one as your “posts page”. Done.

    No need for any home.php stuff – that was for earlier WP versions. And if exists, yes, it will take over the index.
    More: Template_Hierarchy

    Thanks! That was enough for me to puzzle it out. The Codex really turned me around and around on this one.

    The problem with using the “Reading” panel is that it ignores the is_home() function.

    Whatever page is set to be the “Posts” page remains the home, as far as the loop is concerned, making any calls to that function broken.

    Using a home.php template respects the is_home(), but breaks the posts page.

    Edit:
    Nevermind, I just discovered the is_front_page() function, introduced in 2.5.1 (I hadn’t used WP since 2.1 was intro’d).

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] home.php disables index.php?’ is closed to new replies.
Skip to toolbar