WordPress获取页脚函数get_footer用法
WordPress函数介绍——获取页脚函数get_footer详解。

函数原型
该函数位于wp-include/general-template.php 文件的第 61 行左右的位置,代码如下。
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|null $name Name of the specific footer file to use. null for the default footer.
*/do_action( 'get_footer', $name );$templates = array();$name = (string) $name;if ( '' !== $name ) {$templates[] = "footer-{$name}.php";}$templates[] = 'footer.php';locate_template( $templates, true );}使用方法
PHP函数需要使用<?php ?>包裹,调用方法为:
<?php get_footer();?>
函数说明
由上面的函数原型可以看出,get_footer函数需要一个字符串类型参数,并且该参数允许为空,为空时查找主题目录下footer.php文件,不存在则使用默认的 wp-includes/theme-compat/footer.php 作为页脚,不为空时查找footer-参数名.php文件作为头部。
如传入dAImadog
<?php get_footer('daimadog');?>此时将加载主题目录下的footer-daimadog.php作为网站的头部文件。
上一篇:WordPress获取评论模板函数comments_template用法
栏 目:WordPress
下一篇:WordPress获取头部函数get_header用法
本文标题:WordPress获取页脚函数get_footer用法
本文地址:https://zz.feitang.co/CMSjiaocheng/25145.html
您可能感兴趣的文章
- 11-11wordpress导航菜单新窗口打开的设置方法
- 11-11WP-PostViews插件如何修改文章阅读数
- 11-11wordpress附件保存目录改为年月日和上传文件重命名为时间戳
- 11-11WordPress 上传媒体库文件重命名 全格式支持
- 11-11解决wordpress安装后更新或者上传文件权限不足的问题
- 11-11wordpress实现主动推送+熊掌号推送同步进行
- 11-11WordPress 添加友情链接设置 nofollow 属性
- 11-11WordPress 实现 wp_list_bookmarks 自定义友情链接排除调用
- 11-11WordPress首页指定或排除某分类文章显示
- 11-11WordPress不同分类调用不同的文章模板


阅读排行
推荐教程
- 09-22wordpress如何添加描述
- 11-11wordpress附件保存目录改为年月日和上传文件重命名为时间戳
- 10-19纯代码给WordPress网站添加独立下载页面功能
- 11-11WordPress之给文章内容中间插入广告的实现方法
- 10-18wordpress无插件调用随机文章的方法
- 10-18WordPress 技巧:WordPress 后台也使用七牛云存储
- 10-24Win10无法调节声音怎么办?Win10无法调节声音的解决方法
- 10-19WordPress上传图片HTTP错误的解决方法
- 10-18让注册用户可以上传自己的头像的WordPress插件-WP User Avatar v2.
- 11-11国外WordPress精美主题如何DIY汉化成中文版呢?





