wp_head()激活wp_head动作

目录

描述

Fire the 'wp_head' action. Put this template tag immediately before </head> tag in a theme template (ex. header.php, index.php).

wp_head() 描述

用法

 <?php wp_head(); ?> 

wp_head() 用法

参数

This function does not accept any parameters.

wp_head() 参数

示例

In twentyten theme

wp-content/themes/twentyten/header.php:

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
<?php 
 ...
    /* Always have wp_head() just before the closing </head>
     * tag of your theme, or you will break many plugins, which
     * generally use this hook to add elements to <head> such
     * as styles, scripts, and meta tags.
     */
    wp_head();
 ?>
 </head>

wp_head() 示例

注意

wp_head() 注意

源文件

wp_head() 函数的代码位于 wp-includes/general-template.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Fire the wp_head action
 *
 * @since 1.2.0
 */
function wp_head() {
	/**
	 * Print scripts or data in the head tag on the front end.
	 *
	 * @since 1.5.0
	 */
	do_action( 'wp_head' );
}

wp_head() 源文件

相关