Free Templates

Free Templates for you

Header

leave a comment »

will be more detail on things and functions needed to put in your WordPress header file. Open your header.php file.

  1. .
  2. <html>
  3. <head>
  4. <title>My WordPress Theme</title>
  5. </head>
  6. <body>
  7. <div id=”wrapper”>
  8. <div id=”header”>
  9. header
  10. </div> <!– close header –>
  11. <div id=”content”>
  12. .

Now, we are going to put wordpress functions into our header. We start with the title first.

Because WordPress is dynamic, so we can make our site has dynamic title by put this <?php wp_title(); ?> between <title> and </title>. This tag is use to call the title of the page.

  1. .
  2. <title><?php wp_title(); ?></title>
  3. .

But to make the title more interesting, we use the title tag with other PHP codes.

Just copy and paste this code between <title> and </title>.

  1. .
  2. <?php wp_title(”); if (function_exists(‘is_tag’) and is_tag()) { ?>Tag Archive for <?php echo $tag; } if (is_archive()) { ?> archive<?php } elseif (is_search()) { ?> Search for <?php echo $s; } if ( !(is_404()) and (is_search()) or (is_single()) or (is_page()) or (function_exists(‘is_tag’) and is_tag()) or (is_archive()) ) { ?> at <?php } ?> <?php bloginfo(‘name’); ?> – <?php bloginfo(‘description’); ?>
  3. .

And it will look like this

  1. .
  2. <title>
  3. <?php wp_title(”); if (function_exists(‘is_tag’) and is_tag()) { ?>Tag Archive for <?php echo $tag; } if (is_archive()) { ?> archive<?php } elseif (is_search()) { ?> Search for <?php echo $s; } if ( !(is_404()) and (is_search()) or (is_single()) or (is_page()) or (function_exists(‘is_tag’) and is_tag()) or (is_archive()) ) { ?> at <?php } ?> <?php bloginfo(‘name’); ?> – <?php bloginfo(‘description’); ?>
  4. </title>
  5. .

The next thing that we will do is to import our stylesheet file to be use in our theme.

  1. .
  2. <?php bloginfo(’stylesheet_url’); ?>
  3. .

This tag will return our stylesheet url. Put this tag after </title>. But make sure that your CSS file named with style.css.

  1. .
  2. <style type=”text/css” media=”screen”>
  3. <!– @import url( <?php bloginfo(’stylesheet_url’); ?> ); –>
  4. </style>
  5. .

There are some other tags that we need to put in. Just copy this code below and paste it before </head>

  1. .
  2. <link rel=”stylesheet” href=”<?php bloginfo(’stylesheet_url’); ?>” type=”text/css” media=”screen” />
  3. <link rel=”alternate” type=”application/rss+xml” title=”<?php bloginfo(’name’); ?> RSS Feed” href=”<?php bloginfo(’rss2_url’); ?>” />
  4. <link rel=”pingback” href=”<?php bloginfo(’pingback_url’); ?>” />
  5. <meta name=”generator” content=”WordPress <?php bloginfo(’version’); ?>” />
  6. .

Last thing that we need is to put <?php wp_head(); ?> in header.php.

Finally, your header.php file will look like this.

  1. .
  2. <html>
  3. <head>
  4. <title>
  5. <?php wp_title(”); if (function_exists(‘is_tag’) and is_tag()) { ?>Tag Archive for <?php echo $tag; } if (is_archive()) { ?> archive<?php } elseif (is_search()) { ?> Search for <?php echo $s; } if ( !(is_404()) and (is_search()) or (is_single()) or (is_page()) or (function_exists(‘is_tag’) and is_tag()) or (is_archive()) ) { ?> at <?php } ?> <?php bloginfo(‘name’); ?> – <?php bloginfo(‘description’); ?>
  6. </title>
  7. .
  8. <style type=”text/css” media=”screen”>
  9. <!– @import url( <?php bloginfo(’stylesheet_url’); ?> ); –>
  10. </style>
  11. .
  12. <link rel=”stylesheet” href=”<?php bloginfo(’stylesheet_url’); ?>” type=”text/css” media=”screen” />
  13. <link rel=”alternate” type=”application/rss+xml” title=”<?php bloginfo(’name’); ?> RSS Feed” href=”<?php bloginfo(’rss2_url’); ?>” />
  14. <link rel=”pingback” href=”<?php bloginfo(’pingback_url’); ?>” />
  15. <meta name=”generator” content=”WordPress <?php bloginfo(’version’); ?>” />
  16. .
  17. <?php wp_head(); ?>
  18. .
  19. </head>
  20. <body>
  21. <div id=”wrapper”>
  22. <div id=”header”>
  23. header
  24. </div> <!– close header –>
  25. <div id=”content”>
  26. .

From : Cyberhack.net

Next, Part 3 – Index .

Related Post :

Part 1 – Make your Own WordPress Theme

Part 2 – Header
Part 3 – Index
Part 4 – Comment
Part 5 – Sidebar
Part 6 – Footer
Part 7 – Finish!

Written by maketemplates

February 23, 2009 at 8:15 am

Posted in Make Template Wordpress

Tagged with , , ,

Leave a Reply