Header.php - ar-to/WordPress-Theme GitHub Wiki

Here we start adding more specific template tag and functions to the header to make it more dynamic.

Begin by adding

  • bloginfo() to display information about the current website,
  • <?php echo home_url(); ?> and <?php bloginfo('url'); ?> are interchangeble
  • language_attributes() to display the type of document (default is html),
  • body_class() to customize template body classes conditionally,
<!DOCTYPE html>
<html lang="en" <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); //display charset ?>" />
<meta name="author" content="ariel" />
<meta name="description" content="Basic theme for wordpress.org" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php bloginfo('name'); //displays blog title from settings>general ?></title>
<?php wp_head();?> <!--allows plugins api hooks & function.php scripts to work-->
</head>
<body <?php body_class(); //classes can be added conditionally for different templates?>>
  <h1 class="text-center"><a href="<?php bloginfo('url'); //returns site url from settings>general?>"><?php bloginfo('name'); ?></a></h1>
  <h4 class="text-center"><?php bloginfo('description'); //display blog site description or tagline fron settings>general?></h4>
⚠️ **GitHub.com Fallback** ⚠️