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

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.

主站蜘蛛池模板: SHOW| 建始县| 文成县| 屏东市| 清新县| 牟定县| 吴堡县| 藁城市| 迁西县| 迁西县| 普兰县| 蓬安县| 株洲市| 汶上县| 马山县| 烟台市| 大兴区| 云林县| 西宁市| 蕉岭县| 鸡西市| 玛纳斯县| 台北市| 正宁县| 郸城县| 大洼县| 壤塘县| 马鞍山市| 东乌| 寻乌县| 车致| 济南市| 札达县| 什邡市| 太仓市| 台前县| 渝北区| 乌海市| 宜城市| 裕民县| 鸡西市|