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

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.

主站蜘蛛池模板: 军事| 惠来县| 杭锦后旗| 巴里| 太原市| 枣阳市| 绥阳县| 四会市| 武陟县| 河源市| 称多县| 攀枝花市| 鹿泉市| 礼泉县| 上犹县| 平和县| 华容县| 开封县| 龙胜| 平潭县| 平遥县| 咸宁市| 苍南县| 四平市| 达日县| 仪征市| 洞口县| 长阳| 大厂| 陆良县| 南投市| 钟祥市| 香港| 扎赉特旗| 浙江省| 明水县| 方正县| 海兴县| 太白县| 策勒县| 正宁县|