WordPress Theme Development Part 5 – Index, Header & Footer

Take a look on your index.php file. All the static html codes there and we will make them dynamic. So first of all we have to divide this file into 3 section. index.php, header.php and footer.php. Also if you have any sidebars then also create sidebar.php for that.

Here is the current situation of my themes root folder.

Some Important Task

  • In your header.php use this function into the title tag.

<?php bloginfo('title'); ?>

It will show your site title that you set at the installation time. If you want to change the title then go to your admin panel then change the Site Title on  Settings->General page.

  • In header.php just before the closing head tag </head> use this function.

<?php wp_head(); ?>

and in your footer.php just before the closing body tag </body> use this function.

<?php wp_footer(); ?>

Now if you refresh your website you will see the WordPress admin bar shows on the top of the website. It will only show when you logged-in in your WordPress. Looks good yeah ??

Well, these 2 function will do lots of work for us later.

Leave a Reply

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