751 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
CyberShot says

I am working on a site. I made a file called home.php and put that into my theme. WordPress picks it up nicely. I wanted to use home.php so that you wouldn’t have to go through the steps of setting the static homepage and page template stuff. Also so that when the theme is activated, this page will show by default making it easier to set up. I made a template for the blog and set that for the blog page in reading and as the page template. Problem I found is that when I use home.php and then go to the blog page, home shows as the blog even though I have blog set up as a template. Is there a way to set a static homepage without having to set the templates?

423 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $40,000+ on Envato Market
  • Has referred 1+ members
  • Sells items exclusively on Envato Market
+1 more
billyf says

Hello,

Perhaps this diagram can help you in the template hierarchy : http://codex.wordpress.org/File:Template_Hierarchy.png

It seems that naming it to front-page.php is better than home.php (the former being more specific as it only shows up at the homepage, while the latter will show up at the blog posts index page as well).

751 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
CyberShot says

yes but if you use front-page.php then you have to make a page called home, assign the template and then assign it again in the reading options. I don’t want to have to do that. The diagram does not help solve this issue

158 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 50+ members
  • Has sold $1,000+ on Envato Market
  • Sells items exclusively on Envato Market
+1 more
greenshady says

home.php is for the posts page. It is not to be used for any other purpose than to show the latest blog posts.

To do what you want though, you must use front-page.php. It will always overwrite what’s shown on the front page of the site regardless of reading settings. If you take this route, the user only has to go to Settings > Reading to create a blog page (i.e., the posts page) if they choose to have one.

Of course, this is usually not a good idea for public themes (it’s good for client themes though). The theme shouldn’t dictate what’s shown on the front of the site, which is the purpose of front-page.php. I’d go with a custom page template instead to give users more flexibility. Yeah, it means more steps, but I’ve never had a user complain in the past 5 years of doing it this way.

498 posts
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
wopethemes says
If you looking for alway home page template. just add index.php and in page.php include index.php if it’s home page. if(is_front_page())

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by