官术网_书友最值得收藏!

Creating an HTML structure

  1. Now let's create our HTML structure. We will put in some core HTML tags, as shown here:
      <!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<title><?php bloginfo('name'); ?></title>

As you can see, we have DOCTYPE, an html, head, body, and title tags. Now, if you consider starting at the top, we have our <html> tags; sometimes, you want to include a language here, and WordPress has a function that we can actually include in this file to make it dynamic. We can add php language_attributes, which is a function that will determine the language we want the theme to display. You probably want to make your title dynamic, or you want to add your site name; to do that, we can say php and use a function called bloginfo, as shown in the preceding code block. This is really useful because it has a bunch of things that you can get, such as the site name, the description, the character set, URLs, and the list goes on. You can actually look at the documentation to see exactly what it includes. However, what we'll use is name.

  1. Once you save this, you can go back and reload the page. You can see that the title says WordpressDEV, as shown here:

If you remember, this is what we named the site.

  1. Let's go back to our head tag and continue. We'll need a character set, so we'll enter meta charset. Then, we can use bloginfo here as well, and just pass in charset:
      <!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<title><?php bloginfo('name'); ?></title>
  1. Let's save this, and take a look at our source code. Using Ctrl + U, you can look at both the language attributes; it says that we're using English US and the character set is UTF-8, as shown here:

These things can now be controlled from within WordPress.

主站蜘蛛池模板: 龙山县| 富阳市| 湛江市| 余姚市| 松滋市| 日喀则市| 汕头市| 临潭县| 本溪市| 湄潭县| 宜州市| 金沙县| 宁化县| 仲巴县| 渑池县| 米泉市| 峡江县| 台湾省| 双流县| 金坛市| 金山区| 大丰市| 大余县| 平乡县| 浦东新区| 仙桃市| 陇川县| 英吉沙县| 屏南县| 衡阳县| 炉霍县| 芜湖市| 永济市| 固原市| 盐池县| 青阳县| 文化| 会理县| 永善县| 上饶县| 微博|