描述
引入當前主題的頁腳文件 footer.php,如果使用特定的名字,那么就會調(diào)用這個特定名字的頁腳文件 footer-{name}.php 。
如果主題沒有 footer.php 就會引入默認的 wp-includes/theme-compat/footer.php 。
用法
<?php get_footer( $name ); ?>
參數(shù)
- $name
- (string) (可選) 調(diào)用 footer-name.php.
- 默認: None
例子
404頁面
下面的代碼是一個簡單的404頁面模板 "HTTP 404: Not Found" (它應(yīng)該包含在你的主題中,名為 404.php)
<?php get_header(); ?>
<h2>Error 404 - Not Found</h2>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
多個頁腳
不同的頁面顯示不同的頁腳
<?php
if ( is_home() ) :
get_footer( 'home' );
elseif ( is_404() ) :
get_footer( '404' );
else :
get_footer();
endif;
?>
首頁和404頁面的專用頁腳應(yīng)該分別命名為 footer-home.php 和 footer-404.php 。
資源文件
get_footer() 包含在 wp-includes/general-template.php.
相關(guān)函數(shù)
get_header(), get_sidebar(), get_template_part(), get_search_form(),comments_template()
聲明:本站所有文章,如無特殊說明或標注,均為本站原創(chuàng)發(fā)布。任何個人或組織,在未征得本站同意時,禁止復(fù)制、盜用、采集、發(fā)布本站內(nèi)容到任何網(wǎng)站、書籍等各類媒體平臺。如若本站內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系我們進行處理。





倡萌童鞋,我覺得這篇文章不錯,可以轉(zhuǎn)載到我的博客么,我會在文末附上本文的來源地址。