WordPress. Create theme. Header and footer
In last lesson we began to create our own template. Today we create common parts for every site page – header and footer
Header and footer code are situated in header.php and footer.php. Its code includes in index.php with get_header() and get_footer() functions. There is simple html code with some useful php functions in this files. Let’s shortly discuss functions, which we use in this tutorial:
- bloginfo() – show site info. You can pass info parameter which you want to display, for example site name.
- wp_title() – shows the title of current page
- wp_head() – run ‘wp_head’ hook. Read about ‘wp_head’ hook here
- wp_footer() – run ‘wp_footer’ hook.
In source code you can notice, we don’t include css and js files in header.php and footer.php It is recommended to include all styles and scripts in special file functions.php. This file needs to improve template functionality and for custom theme settings. Don’t confuse this file with plugins. Plugins works with sites, not with themes.