Reputation: 6976
I am relatively new to wordpress, I am creating a custom theme, and so far it is going ok. I currently have index.php, header.php, footer.php and sidebar.php. I have now hit a bit that has been puzzling me for a couple of days.
My home page has a slightly different layout to other pages, how do I theme for that change?
My website is essentially made up, of 'static' pages and 2 posts pages, what can I do so that the homepage looks different to the other pages?
Upvotes: 0
Views: 181
Reputation: 1208
If you have a front-page.php that will take precedence over home.php or page.php. Whether or not home.php or page.php are defaulted to (assuming you have both) can be controlled in Settings → Reading. If you do not have a front-page.php, home.php, or page.php, then index.php would be defaulted to.
One difference between home.php and front-page.php is that home.php defaults to being a blog index page. Though both home and front-page may be used to display static or blog index pages.
More info may be found Wordpress' Template Heirarchy page.
Upvotes: 0
Reputation: 454
You need a front-page.php
Please see the template hierarchy
Upvotes: 1
Reputation: 2001
Go into your dashboard, settings>reading, check what the setting is for your home page display. You may need to change it from the default "list of latest posts" to a static page of your choosing.
Upvotes: 1
Reputation: 63566
Create a page template called home.php. WordPress will use it automatically for the start page. Example:
<?php
/**
* Template Name: Home
*/
get_header();
// Do your regular page.php stuff
get_footer();
See also the codex page an Conditional Tags.
Upvotes: 1
Reputation: 8086
You need to use the built-in functions from wordpress such as is_home() and is_front_page().
Upvotes: 0