Header

First, rather than specifying a single language, you use the language_attributes function to print the language code corresponding to the setting in your wp-config.php file (US English, unless you changed it).

In the title tag, first you print the title—which could be the title of a post or page, category, or date archive, depending on where this file is used—and then the name of the site. I'll talk more about why I've arranged the title this way in the next chapter.

For the character set, again you use the blog's setting rather than specifying one. Like the language, the character set is specified in the wp-config.php file.

The meta generator tag is somewhat controversial. On the one hand, it provides search engines with an easy means of counting the number of WordPress sites in the world. On the other hand, if you are not conscientious about keeping up with security releases, the generator tag will tell the whole world when you're running outdated, insecure version of the software. Whether or not you include this tag is your choice; it will not affect WordPress's functionality in any way.

The meta description tag is filled in here with the blog description you entered under Settings ^ General ("Just another WordPress blog," unless you changed it). In the "Search Engine Optimization" section of the next chapter, I'll show you how to generate a unique meta description for every page of your site.

In the next line, bloginfo(tstylesheet_url') prints the URL of the current theme's stylesheet. As you'll see later, there's a similar bit of code you can use to link to other files in the theme directory.

The next two lines print links to the RSS2 and Atom feeds for the site. There are a number of other feeds you might link here; see Chapter 4 for a complete list.

The pingback URL simply prints a link to your site's XML-RPC file (http://example.com/xmlrpc.php), which allows the trackback feature to function.

The wp_head() function should appear just before the closing </head> tag. It's a hook, which means that it does not print anything directly, but serves as a placeholder function. Developers can add their own code to this hook when they need to insert something—an extra stylesheet or script, for example— to the page header. There are a few built-in functions that hook into wp-head(), mostly to call JavaScript files.

Was this article helpful?

0 0

Post a comment