• Hi.
    I am trying to help out a co-worker with his blog. I have set up a home.php it the theme dir as the splash page that will display only the latest posting. The problem is, I can never get the regular index.php to display, with the 5 latest postings (as setup in wp-admin). I have temporarily put a link at the bottom of home.php that links to the latest monthly archive to make a temp fix, but I would rather it link to the standard index.php with all the latest posts. I am assuming i would have it link to https://www.chadsreviews.com/index.php, but maybe it is supposed to be something different? I have read some of the similar topics, but don’t quite know why I can’t get it to work. Is the problem perhaps that my site is at the root and not in a /wp dir or something?
    Any help is very much appreciated.
    Here is the site: https://www.chadsreviews.com (this would get you the home.php)
    What I need is to know how to get to the standard index.php from that page.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • In a sense you’re trying to create two separate home pages, and that’s not possible (at least, not through the steps you’re trying to take). The thing about template hierarchy with 1.5 themes is that index.php has taken on a secondary or backup role to all the other query-type (main) templates. When it exists, home.php is effectively the *default* page for a blog, and there’s no ability to override this.

    What I’d recommend–in either home.php or index.php–is to use a bit of PHP to verify if there’s no query-string in the url (i.e. one is at the very top of the blog), and switch between the *home* and *index* components or views of your home page. So you could start off by placing this before the home-related content:

    <?php if($_SERVER['QUERY_STRING']) : ?>

    At the end of “home” it’s a simple:

    <?php else : ?>

    followed by the index-related features, and finally closing with:

    <?php endif: ?>

    I’m using that and it works fine… now how can I determine if a page is a https://www.mypage.com/?cat=whatever page?

    also, if I want to first check if it’s my index.php page, and then check if it’s a /?cat=whatever type page, can I use a ‘switch/case’ function instead of an ‘if/else’ function? how do I write that in code?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘home.php / index.php problem…’ is closed to new replies.