• I am only very new to html and css and the way wordpress separates the header, the post and the footer into different php files both facinates and perplexes me. First, why do they do this and second, what file brings this all together into a single view on the front end.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Have a look at Theme Development.

    The main purpose of separating them is to make the structure flexible n easier if you don’t differentiate them then on each page you’ll have to provide the links for the header ,footer and the right/left panel if present for eg.if you want to change the name of a link in your header the changes will be available to all the pages if the header is differentiated or else the small change has to be done in all the pages .This is the idea behind creating separate templates .

    lastly it is included in index.php file like
    <?php include(“header.php”);?>
    <?php include(“footer.php”);?>

    Thread Starter craigjross

    (@craigjross)

    @usubba
    That is a great explanation. Thanks for taking the time to spell it out for me. Can the same approach be applied to straight up html/css sites that dont include php? the reason I ask is that I dont know php yet and would like to get familiar with this way of developing as I start to learn the php side of things.

    @esmi
    Thanks so much for the link. I will be having a long look at theme development. I think that I will learn a lot from reading this.

    Thread Starter craigjross

    (@craigjross)

    I’ve been doing some homework and found SSI. Server Side Includes for html. Such as;
    <!–#include file=”included.html” –>
    This stuff is so cool.

    Don’t use this:

    <?php include("header.php");?>
    <?php include("footer.php");?>

    Use get_header(), get_footer(), get_sidebar() for header.php, footer.php, and sidebar.php respectively. Use get_template_part() for including any other, arbitrary template-part file.

    Thread Starter craigjross

    (@craigjross)

    Thanks, Chip.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Why are different parts of the page separated into different template files’ is closed to new replies.