get_footer()
get_footer( string $name = null )
加载页脚模板。
Load footer template.
说明(Description)
包含主题的页脚模板,或者如果指定了名称,则将包含专门的页脚。
对于参数,如果文件名为“footer”-特殊.php然后指定“特殊”。
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$name | (string) | 可选 | 专门页脚的名称。 |
返回(Return)
无返回值
源码(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'); }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
1.5.0 | wp-includes/general-template.php:57 | 0 | 3 |
笔记(Notes)
多页脚
命名页脚模板
简单404页
get_footer() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_footer/