Creating Template Header

Theme File Header and Theme Header are two different things. In descriptive words Template header means Template Header. Theme file header defining in stylesheet to tell WordPress regarding the theme we are creating. WordPress to define theme it uses File Header (style.css). For developing themes we are using headers and footers to include our theme header and footer in every page we want.

Theme File Header contains theme information and Theme Header contains HTML codes in simple words. Hope you are didn’t get any conflict.

To create header file, you need to create header.php file. This file contains common header information of the web site we are creating. Assume we have one header for home and another header for pages. In that case we can create two header files. Because WordPress let us create any number of headers but need to include relevant one in relevant place. We can create one header file as header.php and other one as header–v1.php. Where you calling header.php you can just called as get_header(); and when you’re calling header–v1.php it should be called as get_header('v1'); Are you wondering with keyword of the get_header(). get_header() is a WordPress function which let us include our header file. WordPress manage to include correct file according to our request. So, we have nothing to worry about and WordPress cares all about.

Lets code our header.

Now you have created our header file. Then navigate to index.php and include get_header() within PHP tags. Code should be like

<?php get_header(); ?>

. This will includes the content in header.php file into index.php file.

Finally code will be like:

<?php get_header(); ?>
<!--/ Middle Content -->
<?php get_footer(); ?>

Hope you all done. Lets move onto next.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *