How to Use the Twenty Fifteen WordPress Header Template - dummies

How to Use the Twenty Fifteen WordPress Header Template

By Lisa Sabin-Wilson

The Twenty Fifteen theme in WordPress contains the Header template. The Header template is the starting point for every WordPress theme because it tells web browsers the information for the following:

  • The title of your blog

  • The location of the CSS

  • The RSS feed URL

  • The blog URL

  • The tagline (or description) of the website

Every page on the web has to start with a few pieces of code. In every header.php file in any WordPress theme, you find these bits of code at the top:

The DOCTYPE (which stands for document type declaration) tells the browser which type of XHTML standards you’re using. The Twenty Fifteen theme uses <!DOCTYPE html>, which is a declaration for W3C standards compliance mode and covers all major browser systems.

The <html> tag (HTML stands for Hypertext Markup Language) tells the browser which language you’re using to write your web pages.

The <head> tag tells the browser that the information contained within the tag shouldn’t be displayed on the site; rather, that information is about the document.

In the Header template of the Twenty Fifteen theme, these bits of code look like the following example, and you should leave them intact:

<!DOCTYPE html>
<html <?php language_attributes(); ?> class=“no-js”>


On the Edit Themes page, click the Header template link to display the template code in the text box. Look closely and you see that the <!DOCTYPE html> declaration, <html> tag, and <head> tag show up in the template.

The <head> tag needs to be closed at the end of the Header template, and the closing tag looks like this: </head>. You also need to include a fourth tag, the <body> tag, which tells the browser where the information you want to display begins. Both the <body> and <html> tags need to be closed at the end of the template files (in the footer.php), like this: </body></html>.

The Header template makes much use of one WordPress template tag in particular: bloginfo();.

A parameter differentiates the type of information that a tag pulls in. Parameters are placed inside the parentheses of the tag, enclosed in single quotes. For the most part, these parameters pull information from the settings in your WordPress Dashboard. The template tag to get your site title, for example, looks like this:

<?php bloginfo( ‘name’ ); ?>

This list shows the various parameters you need for the bloginfo(); tag and shows you what the template tag looks like. These parameters are commonly used in the header.php template file in many WordPress themes and pertain to the bloginfo(); template tag only.

Parameter Information Tag
charset Character settings, set in Settings/General <?php bloginfo( charset ); ?>
name Site title, set in Settings/General <?php bloginfo( name ); ?>
description Tagline for your site, set in Settings/General <?php bloginfo( description
); ?>
url Your site’s web address, set in Settings/General <?php bloginfo( url ); ?>
stylesheet_url URL of primary CSS file <?php bloginfo( stylesheet
pingback_url Displays the trackback URL for your site on single post
<?php bloginfo( pingback_url
); ?>