ThemeShaper Forums » Thematic


When is home page home? [child theme]

(5 posts)
  • Started 13 years ago by Cosmo
  • Latest reply from ChocHippo
  • This topic is not resolved
  1. Hi...

    I've been trying to teach myself how to to make child themes. Tried following a couple of the tutorials on but kept getting to a point where I just couldn't get something to work properly. I'm fairly versed in html, CSS, and have been using Wordpress for a few years [solely for the past 5]. Know enough about php to figure out what a piece of code means but don't know how to do it really.

    A few days ago I found a book from sitepoint called "Build Your Own Wicked Wordpress Theme" which uses Thematic and the Thematic Sample Child Theme to demonstrate.

    Everything went fine 'till I got to a part where it started dealing with home.php which was based on index.php of Thematic. I set it up and when I checked out the site things were quite confusing.

    The action I had set to happen on the home page happened on the page I had set up for posts. I couldn't get it to work and after a few frustrating hours re-loaded WP on the site and started over. I still hit the same snag even though before trying anything I made sure to set a home page and a posts page.

    Same thing when I got to that point in the instruction. So I thought maybe it was because it was on an MU site. I took a fresh virgin domain and installed WP on it making sure to set it up with home and posts pages, even populated it with standard WordPress Theme Unit Test Data for content.

    Same thing.

    So what does WP consider the home page? I was certain it was the default page that one would land on when typing - in HTML that would be the index page.

    Could someone point me in the right direction?

    ... Kent

    Posted 13 years ago #
  2. middlesister

    Ok let me see if I can help you. I have been somewhat confused myself in the past regarding what wordpress is considering "home" and "front page", and this is the understanding I have so far. If someone else has a clearer view or notice I am wrong please enlighten me.

    Some of the confusion around this comes from the need to differentiate between a page as in a webpage you are viewing and wordpress Posts and Pages. I will write Page with a capital P to distinguish a wordpress Page, and page with a small p to refer to a "normal" webpage ( like ).

    Wordpress, being a blog platform from the start, considers "home" to be the page where your blog posts are shown. These days, you can choose to display a static page as a front page as specified in Settings->Reading. What is important to realise is that the conditional is_home() will still refer to your blog posts page!

    Compare these two conditionals in the wordpress Codex:

    If your home page ( like ) is the page with your blog posts then on that page both is_home() and is_front_page() will be true. If your home page is set to be a wordpress Page in the settings, then on that Page is_home() will be false, but is_front_page() will be true!

    To add insult to injury in this mix, in comes the possibility of page templates. I haven't read the sitepoint book, but I guess this is what you are working with since you are talking about a home.php. It is quite common to want your front page to look different than the other pages, and so use a page template for that. You first set the wordpress Page to use your page template, and then set that wordpress Page as your front page in Settings->Reading. Simple, right? The question is - what do you do with the blog posts webpage?

    I have in the past had a different page template for my blog posts - blog.php - and I noticed some weird behaviour regarding this. When you specify which Page to use for blog posts in Settings->Reading, the contents of that Page will not be shown and wordpress will use that to display your Posts ( I think in effect it is loading index.php ). This means that on this Page, is_home() will now be true! And in my case, my template blog.php was not being picked up at all since wordpress was overriding everything.

    My solution was to keep the selection box for the Posts page in the Reading Settings empty. I select my Page as static front page, but don't select anything for my Posts page. And then I had a Page with my custom blog.php page template selected and treated it like any other Page.

    Does this make any sense, or am I just confusing things more?

    I'll try to summarize:
    Wordpress calls what other people call "home" - i.e. the first page you see when typing - a front page. This may or may not be displaying your blog posts. The page you set up for the blog posts is considered home - regardless whether it is your front page or not. If you want to be sure that what you work with will end up on the "home" page, use is_front_page() in your code.

    Posted 13 years ago #
  3. Be careful what you name your page templates:

    Posted 13 years ago #
  4. middlesister

    Ah, I see. I didn't know home.php was one of the 'built-in' page templates. Haven't used it myself. Still I wasn't too far off, home.php gets loaded when is_home() is true - which is the webpage showing your blog posts.

    Use the page template front-page.php if you want to target the default landing page of your website.

    Posted 13 years ago #
  5. ChocHippo

    Had the same problem - reading the same book (Sitepoint's "Build Your Own Wicked Wordpress Theme"). Have been going loco trying to find the solution - until I found this forum - front-page.php fixed everything! THANK YOU so much for explaining!!!

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.