No. You have to have an index. You’d do well to read up on wordpress template hierarchy.
Sorry to labor on this folks. So I can set the Index to be the Home page if I want to, provided the Index template is there at all costs? A Home template is therefore not required. All I need to do is assign the Index to the home page in the back-end if I want that as the basic set-up. Is that right?
If you’re using posts, then by definition you’re using a blog, I would say. ;)
The list of most recent blog posts is displayed by using the Main Index template (which is called index.php). By default, your home page uses this template.
However, you can change this in your WordPress settings, so that your home page will just show any other page that you have created (General –> Reading), and you can set any page to show your news posts there too; this page will then use the Default index.php template.
I may have confused myself here a bit…. :-/
@tobeeornot I think that a default WordPress install uses the Index to be the home page anyway indeed, and that’s all good.
Indeed, you can’t actually assign the Main Index template to any page. It will just be applied to whatever page you decide will be your POSTS page (by default your home page, or the page you set as the home page in General > Reading).
What do you mean by the Index file exactly — the file called Index.php? And I’m not sure what you mean when you say you’re not using a blog. Does that mean you are not using any Posts, but only (static) pages?
Let’s say you have a few blog posts and two static pages, one called “Stuff”, the other called “News bits”.
By default, the blog posts are being shown on your site’s home page (the starting page of your site, AKA front page), using the Main Index Template (a file called Index.php). So if you don’t have any posts, it won’t show much other than what’s in the template.
As for the static pages: both the “Stuff” page and the “News bits” pages use any template you choose (by default this is the Default Template, a file called Page.php) and show whatever content you have entered in WordPress). If this is the behavior you want, then you’re done and nothing else to worry about.
Sometimes, you want your site’s home page to show something else, like a static page with just content (if you don’t use the blog feature, for example). So in this case, you can use your “Stuff” page for that. Going to Settings > Reading and set your front page to be a static page, and set the Front page to “Stuff”. However, you also want your blog posts to show somewhere, if you have them. Since they are not shown on the front page anymore, it would make sense to put them on the “News bits” page, so that’s the page you should set as Posts page.
Because your “News bits” page is now set as the page where your blog posts will show, this page will now not use the Default template anymore, but the Main Index Template. In fact, whatever content you have entered in your “News” page, and whatever template you’ve chosen there, will not matter at all now. The posts page will always use the Main Index Template to show the blog posts.
It took me a while to get my head wrapped around this concept, but I hope I got my point across. :)
index.php is the fall back for ALL pages.
For your home page, it’s recommended using either front-page.php or home.php. Never use index.php for your home page, it should be used as a ‘generic’ fall back.
I always use front-page.php and set that page in Settings > Reading.
@TheDoc: when you say it’s the fall back for all pages, are you referring to the index.php in the root of your site, or the one in wp-content/themes/(themename)/?
The one in the root of your site is indeed the (back-end) page that’s used for all pages, but I was referring to the latter. That’s (by default) the Main Index Template that is (to the best of my knowledge) only used to show the most recent posts, and it’s not used for anything else….or is it? Not 100% sure now, you make me doubt myself. ;)
By default, WordPress uses /wp-content/themes/(themename)/index.php as the template for the posts page. If (like you say) you should never use it for a home page, I would think WordPress would not set it as the default home page template?
Yep, you can make custom templates such as front-page.php or home.php or whateveryouwanttonameit.php to use for the home page, but I’m not really sure if that’s what beginners should try to fiddle with right away. And I don’t see why index.php (the Main Template) should not be used for that.
You must be logged in to reply to this topic.