1. 首页
  2. WordPress钩子手册

get_footer

do_action( ‘get_footer’, string|null $name )

动作钩子::在加载页脚模板文件之前激发。
Action Hook: Fires before the footer template file is loaded.

目录锚点:#参数#源码


参数(Parameters)

参数 类型 说明
$name (string | null) 要使用的特定页脚文件的名称。默认页脚为空。

源码(Source)

/**
 * Load footer template.
 *
 * Includes the footer template for a theme or if a name is specified then a
 * specialised footer will be included.
 *
 * For the parameter, if the file is called "footer-special.php" then specify
 * "special".
 *
 * @since 1.5.0
 *
 * @param string $name The name of the specialised footer.
 */
function get_footer( $name = null ) {
	/**
	 * Fires before the footer template file is loaded.
	 *
	 * The hook allows a specific footer template file to be used in place of the
	 * default footer template file. If your file is called footer-new.php,
	 * you would specify the filename in the hook as get_footer( 'new' ).
	 *
	 * @since 2.1.0
	 * @since 2.8.0 $name parameter added.
	 *
	 * @param string $name Name of the specific footer file to use.
	 */
	do_action( 'get_footer', $name );

	$templates = array();
	$name = (string) $name;
	if ( '' !== $name )
		$templates[] = "footer-{$name}.php";

	$templates[] = 'footer.php';

	// Backward compat code will be removed in a future release
	if ('' == locate_template($templates, true))
		load_template( ABSPATH . WPINC . '/theme-compat/footer.php');
}
更新版本 源码位置 使用 被使用
2.8.0 wp-includes/general-template.php:66 1 0

get_footer 为WP2原创文章,链接:https://www.wp2.cn/hook/get_footer-2/

发表评论

您的电子邮箱地址不会被公开。