WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Blog page constantly reverting to index page

[Resolved] Blog page constantly reverting to index page

  • Hi,

    I have an issue that I seem to only have with wordpress 3+ Basically, if I want a blog page to be something other than the home page, for some reason wordpress reverts to using the index.php rather than the blog.php template i have set up for this purpose.

    Its making me nuts. I have the “BLog” page set up to use the blog template via the dropdown, and the reading options to use the blog page as the Posts page. But it still reverts to index.php

    Now i could just copy the code from blog.php to index.php….except when i put a query in there to display only posts from the blog category, it has a bird and can’t find anything.

    I’ve even tried to rename blog.php to home.php …no dice. it will still only use index.php

    Suggestions? I’m at my end with this.

    thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Chip Bennett

    @chipbennett

    Theme Review Admin

    What is your Front Page set to display: Static Page or Blog Posts?

    If Static Page:
    1) What Page is set to display on the Front Page
    2) What Page is set to display the Blog Posts Index

    Ha! found it. Figures right after I post something.

    as far as I know you can’t use a custom template for the Blog page
    ref
    http://codex.wordpress.org/Creating_a_Static_Front_Page
    Do not use a custom Page template for this page!

    Chip Bennett

    @chipbennett

    Theme Review Admin

    @nadine00:

    Ha! found it.

    So, what was it? (In case someone else might be helped by the same solution.)

    @samuel B:

    as far as I know you can’t use a custom template for the Blog page

    Yes, you can; but it has a specific template name.

    The front-page.php template will always be used for the Front Page, whether it is set to display a Static Page or Blog Posts.

    The home.php template will be used to display the Blog Posts Index, whether they are output on the Front Page, or a Static Page.

    The fallback for a Static Page on the Front Page is page.php, and the fallback for the Blog Posts Index is index.php.

    Chip, please explain the solution? I’ve been pulling my hair out. So edit index.php directly? (that doesn’t sound like a good idea)

    Chip Bennett

    @chipbennett

    Theme Review Admin

    @lukeratto:

    Chip, please explain the solution? I’ve been pulling my hair out. So edit index.php directly? (that doesn’t sound like a good idea)

    What is your specific problem, for which you need the solution?

    @chip Bennett
    I have a static home page template assigned/active and would like to assign a custom template for the “Blog”. Basically just having one Category post to the “Blog” with custom sidebar.

    Like you I created a custom blog template file, assigned it and nothing happens, the Blog layout remains the same. From what you wrote above, I need to alter my “home.php” file? So just copy my custom blog template code and paste it in the home.php file and walla?

    Thanks for your time and help

    Chip Bennett

    @chipbennett

    Theme Review Admin

    Like you I created a custom blog template file, assigned it and nothing happens, the Blog layout remains the same. From what you wrote above, I need to alter my “home.php” file? So just copy my custom blog template code and paste it in the home.php file and walla?

    You already have a home.php template file in your Theme? If so, rename it home-old.php (just as a backup).

    Then, rename your blog.php as home.php. WordPress will automatically use it for your Blog Posts Index, on whatever static Page you have assigned to display your blog posts.

    Note that WordPress will never take into account any custom page template assigned to the static Page that displays the Blog Posts Index. WordPress will only ever use the following template files, in order of preference:

    1. front-page.php (if Front Page is set to display blog posts)
    2. home.php
    3. index.php

    Refer to the updated Template Hierarchy diagram, for a visual explanation regarding why WordPress will never use a custom page template for the static Page assigned to display the Blog Posts Index.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Blog page constantly reverting to index page’ is closed to new replies.