Support » Themes and Templates » One of these pages is not like the other

  • I’m using WordPress for a client mostly as a CMS — the pages are the pages of the site and then I’m using the posts for a gallery of pictures she has. The problem I have is that the front page of the site looks very very different from the rest of the subpages of the site. Right now, I’m using page.php to create my subpages and index.php to create the gallery. How best to create to create the front page of the site and then tell WordPress that it’s the front page? As a php programmer, I’m a beginner but I’m becoming an intermediate pretty quickly much to my dismay because I thought I wouldn’t have to.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can go to Settings -> Reading, then set your Front Page to be a static page from the drop-down. The pages in the drop-down will show up from the list of pages that you create.

    Thread Starter katyjack

    (@katyjack)

    I guess I should have been more clear. I do know how to tell WordPress that it’s the Front Page, what I don’t know how to do is to make a page that looks very different from all the other pages. Do I need to create a new .php file to do that for just that page?

    Hey katyjack,

    As I understand it, you would like a homepage that looks different to your subpage. If this is correct, you have two options:

    1. Use the is_front_page() conditional tag. Essentially, you would have both of the content layouts (homepage and subpage) in the page.php file. You would then run a conditional like this:

    <?php
    if ( is_front_page() )
    {
    INSERT FRONT PAGE CONTENT LAYOUT HERE
    } else {
    INSERT SUBPAGE CONTENT LAYOUT HERE
    }
    ?>

    This option only works if the layout isn’t too different. If it’s completely different, your other option is a custom template file.

    2. Custom template file. Create a copy of page.php and rename it to homepage.php, or something explanatory like that. At the top of homepage.php in the code, type:

    <?php
    /*
    Template Name: Homepage
    */
    ?>

    You now have a custom page template. 🙂 In WordPress, edit the page that you are using as your homepage. In the “Attributes” box, select your new template from the “Page Template” select box.

    This should now give you a custom layout for your homepage. 🙂

    I hope this helps.

    Cheers,
    Matt.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘One of these pages is not like the other’ is closed to new replies.