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

Adding a function in the head tag

We will next see how to enter a function called wp_head() in the <head> tag. This puts any additional information that is needed into the head tag. For example, when you install a plugin and, let's say, it needs to include a style sheet, or it needs to do something in the head, to do this we need to enter the following code. So when you create plugins, you can have stuff pop out right in the head:

<!DOCTYPE html>
<html <? php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<title><?php bloginfo('name'); ?></title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
<?php wp_head(); ?>

In the following source code, we have a bunch of other stuff now, and this is all coming from that wp_head() function:

If I go ahead and take the wp_head() function out, and then go back and reload, it just gives us what we have in the index.php file. So we're going to need the wp_head() function:

In the next section, we'll start to build out the body. We will see how to grab posts, create menus, and so on.

主站蜘蛛池模板: 富宁县| 米易县| 松潘县| 靖安县| 黄骅市| 吉首市| 长沙县| 涿州市| 宁明县| 巢湖市| 黎平县| 沙田区| 镶黄旗| 上蔡县| 寿宁县| 博湖县| 罗田县| 家居| 商城县| 信阳市| 乐清市| 荣成市| 焦作市| 达州市| 定襄县| 诸城市| 株洲市| 凤城市| 富阳市| 航空| 夹江县| 麻江县| 石门县| 成武县| 临汾市| 迭部县| 合江县| 宜黄县| 务川| 衡东县| 北安市|