I will update Premium Account on this website Shareaccounts.org

WordPress theme-create header.php

Next, create a new PHP file header.php in the theme directory wp-content\themes\bbbbf we created last time. We extract the header code in index.php and copy and paste it into header.php. The following code is all the code in header.php (of course, the header code of different themes is different, and you can decide it yourself in your actual project):

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head profile=”http://gmpg.org/xfn/11″>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Aurelius | Blog</title> <!– Stylesheets –> <link rel=”stylesheet” href=”./style.css” type=”text/css” media=”screen” /> </head> <body> <div id=”wrapper” class=”container_12 clearfix”> <!– Text Logo –> <h1 id=”logo” class=”grid_4″>BBBBF</h1> <!– Navigation Menu –> <ul id=”navigation ” class=”grid_8″> <li><a href=”contact.html”><span class=”meta”>Get in touch</span><br /> Contact Us</a></li> <li><a href=”blog.html” class=”current”><span class=”meta”>Latest news</span><br /> Blog</a></li> <li><a href=”index.html”><span class=”meta”>Homepage</span><br />
Home</a></li>
</ul>
<div class=”hr grid_12 clearfix”>&nbsp;</div>
<!– Caption Line –>
<h2 class=”grid_12 caption clearfix”>Our <span>blog</span>, keeping you up-to-date on our latest news.</h2>
<div class=”hr grid_12 clearfix”>&nbsp;</div>
~~~

Open index.php, archive.php, contact.php, full_width.php, page.php and single.php with a text editor, delete the above similar code, and change it to:

~~~
<?php get_header(); ?>
~~~

Let’s modify header.php together:
**1. Change <title>**

We all know that the titles of different pages are different, and the title setting will directly affect the SEO effect, so it should be set carefully here. Here is a SEO-optimized title writing method. Change <title>BBBBF | Blog</title> to:

~~~
<title><?php if ( is_home() ) {
bloginfo(‘name’); echo ” – “; bloginfo(‘description’);
} elseif ( is_category() ) {
single_cat_title(); echo ” – “; bloginfo(‘name’);
} elseif (is_single() || is_page() ) {
single_post_title();
} elseif (is_search() ) {
echo “search results”; echo ” – “; bloginfo(‘name’);
} elseif (is_404() ) {
echo ‘page not found!’;
} else {
wp_title(”,true);
} ?></title>
~~~

The php code added above uses conditional judgment and uses different titles for different pages. Here are some explanations of these conditional tags.

* is_home(): Returns true if the current page is the homepage
* is_category(): Returns true if the current page is a category page
* is_single(): Returns true if the current page is a single article page
* is_page(): Returns true if the current page is a single page
* For more details, see the WordPress documentation: Conditional Tags