WordPress.org

Ready to get started?Download WordPress

Forums

Load time vs. template files (5 posts)

  1. Miroslav
    Member
    Posted 7 years ago #

    Is there any relation between how fast a site loads and the number of template files used?

    In other words --- with all other things being equal --- which site would load faster:

    Site 1, consisting of:

    index.php
    style.css

    or...

    Site 2, consisting of:

    index.php
    archive.php
    page.php
    single.php
    search.php
    404.php
    category.php
    home.php
    comments.php
    style.css

    Is there any difference, at all?

  2. whooami
    Member
    Posted 7 years ago #

    Everything else being equal, same amount of images and extraneous stuff? It wouldnt make a bit of difference.

  3. Miroslav
    Member
    Posted 7 years ago #

    So, it doesn't take more time to asseble a page from more template files as opposed to putting it together from one template file?

    Also, is there a difference (in load time) between the default WP template files (index.php, archive.php, etc.) and custom template files (called via php includes)?

  4. whooami
    Member
    Posted 7 years ago #

    uh, are you counting in milleseconds? IF theres a difference, thats what it's measured in.

    And ALL template files (for all intents and purposes) are already called via includes, so no, there would be no difference between that and "custom template files" (see wp-includes/template-loader.php for proof).

    Fwiw, you left sidebar.php, header.php, and footer.php off your list. I see why, but all the same unless your being completely all-inclusive with the code within all of those other files....... (see where im going with this?)

    Aditionally, and this is where all things become NOT so equal. If you were to apply all of the code inside comments.php to your index.php (youve assigned comments.php to the extra theme files list, when really its not one, so its a good example) -- you would need additional PHP within index.php to indicate when comments.php should be displayed.. all of the time, or single view, etc.. All of a sudden you've added some PHP to do decision making.. hmm, things still equal? I dunno.

  5. Miroslav
    Member
    Posted 7 years ago #

    Good points, whooami! Thanks! :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags