Posted By

blueocto on 12/29/10


Tagged

header wordpress doctype


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

omaidog
Farhan
clintonhalpin


Wordpress : header.php


 / Published in: PHP
 

URL: http://codex.wordpress.org/Theme_Development#Document_Head_.28header.php.29

* Use the proper DOCTYPE.
* The opening  tag should include language_attributes().
* The "content-type" meta element should be placed before everything else, including the title element.
* Use bloginfo() to fetch the title and description.
* Use automatic feed links to add feed links.
* Add a call to wp_head(). Plugins use this action hook to add their own scripts, stylesheets, and other functionality. 

Here's an example of a correctly-formatted HTML5 compliant head area:

  1. <!DOCTYPE html>
  2. <html <?php language_attributes(); ?>>
  3. <head>
  4. <meta charset="<?php bloginfo( 'charset' ); ?>" />
  5. <title><?php wp_title(); ?> <?php bloginfo( 'name' ); ?></title>
  6. <link rel="profile" href="http://gmpg.org/xfn/11" />
  7. <link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" type="text/css" media="screen" />
  8. <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
  9. <?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); ?>
  10. <?php wp_head(); ?>
  11. </head>

Report this snippet  

You need to login to post a comment.