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

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.

主站蜘蛛池模板: 济源市| 巍山| 永春县| 德安县| 宜昌市| 广宗县| 遂昌县| 海盐县| 晋中市| 桦甸市| 青海省| 会同县| 高唐县| 定远县| 静安区| 宁南县| 卢氏县| 金湖县| 瓮安县| 天祝| 康乐县| 清原| 东乌珠穆沁旗| 贵溪市| 永春县| 德保县| 湾仔区| 平遥县| 逊克县| 永定县| 瓦房店市| 祁门县| 方正县| 济源市| 湘阴县| 富宁县| 三门峡市| 石城县| 沙田区| 织金县| 隆林|