Grow your CSS skills. Land your dream job.

WordPress – Index & Home

  • # December 14, 2011 at 6:03 am

    Sorry if this is a silly question but what is the difference between these templates in WP, and should they just be the same?

    # December 14, 2011 at 6:06 am

    Index is where your blog posts will show (site.com/blog) and home would be your homepage (site.com).

    However, you can make the index page your homepage.

    # December 14, 2011 at 6:10 am

    So you don’t necessarily need to have an Index if you don’t have a blog per se? You can simply have the Home.

    # December 14, 2011 at 6:14 am

    I’m not sure I would delete it, maybe you’ll change your mind. I think blogging is important, not just for others, but for you as well. It shows your progress.

    # December 14, 2011 at 6:15 am

    No. You have to have an index. You’d do well to read up on wordpress template hierarchy.

    http://codex.wordpress.org/Template_Hierarchy

    http://www.doitwithwp.com/rundown-wordpress-theme-files-what-they-do/

    # December 14, 2011 at 6:20 am

    @Brightonmike – thanks, I have just been reading that, hence my confusion. If you not using a blog but just using posts, what should it be used for if I have to have it?

    # December 14, 2011 at 7:03 am

    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?

    # December 14, 2011 at 7:16 am

    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…. :-/

    # December 14, 2011 at 7:23 am

    @Senff – I sort of get it. But if you want Index to be the home page, that is fine? I notice you can’t assign the Index template to a page.

    # December 14, 2011 at 7:27 am

    @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).

    # December 14, 2011 at 7:47 am

    @Senff – Ok, I have assigned the front page to be the Home in the settings and it works fine. I am still a little unclear what the Index file should be used for if you are not using a blog?

    # December 14, 2011 at 8:21 am

    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. :)

    # December 14, 2011 at 8:49 am

    @Senff – I totally get it now. That is a really clear explanation and I’m petty sure I have got my head around it. I really appreciate you going to lengths that you did in your last post because it wasn’t quite clicking before :)

    # December 14, 2011 at 6:15 pm

    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.

    # December 14, 2011 at 7:22 pm

    @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.

Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".