WordPress Theme Tags: ‘include’


There are 2 types of include tags. The first type are have set properties. they include:

<?php get_header(); ?> // include header.php
<?php get_footer(); ?> // include footer.php
<?php get_sidebar(); ?> // include sidebar.php
<?php comments_template(); ?> // include comments.php

The second type is more flexible, you can include any file you want. You set the property:

<?php include (TEMPLATEPATH . ‘/header2.php’); ?> //notice the header2.php

there are many ways to use this. In my theme Indian Red I used it to load the 4 boxes at the top. I did this so the users could edit the files easily.

So if you wanted to show a different header section for pages than the rest of the site you could write a condition statement such as:

if (is_page())
include (TEMPLATEPATH . ‘/header2.php’);
} else {

I’ll tell you more about condition statements later.

Leave a Reply

CommentLuv badge
Powered by Wordpress | Designed by Elegant Themes