Using home.php with blog post on inside page (4 posts)

  1. digne
    Posted 6 years ago #

    My theme uses a different template for the front page (home.php) then it does for the inside pages (index.php). But I want the blog posts to appear on an inside page not the front page. But when I select a page for the blog posts to go (in Settings > Readings) it uses the wrong template. It uses home.php to make both the blog page and the front page and since home.php doesn't have the WordPress Loop the blog posts don't appear at all.

    I tried to get around this using both if (is_front_page()) and if (is_home()) by combining the information of both home.php and index.php into one file (I tried it separately using both file names: home.php and index.php) but then it just uses the information from the index.php template to create both the front page and inside blog post page.

    Anyone know a way around this?

    I've applied the theme to newer WP versions here's it on an older version of WP:

  2. bitkahuna
    Posted 6 years ago #

    going to suggest something 'dumb' but i think something like this has bitten me before.

    try renaming home.php to something else, like myfrontpage.php.
    i think wordpress treats a file named home.php specially, and this might be causing your problems.

  3. raskull
    Posted 6 years ago #

    If I understand you correctly, here is what you need to do:

    keep index.php as it is

    change the name of home.php to something else as suggested above

    in the file formerly named home.php add this code at the top to make it into a template (make sure it is within php tags):
    /* Template Name: Home */

    in admin create a Page named Home and apply the Home template you just made using the pulldown menu in the right column

    in settings > reading, choose a static page for your front page and choose Home from the pulldown menu. Choose any other page for your blog (index.php)

  4. Brandon Moeller
    Posted 6 years ago #

    Yes. This is the key. Thanks raskull. You helped me regain my sanity - for the moment.

Topic Closed

This topic has been closed to new replies.

About this Topic