get_footer

函式
get_footer ( $name = null, $args = array() )
引數
  • (string) $name The name of the specialised footer.
    Required:
    Default: null
  • (array) $args Optional. Additional arguments passed to the footer template. Default empty array.
    Required:
    Default: array()
返回值
  • (void|false) Void on success, false if the template does not exist.
定義位置
相關方法
get_termwp_footerget_termslogin_footeriframe_footer
引入
1.5.0
棄用
-

get_footer: 這個函式是用來檢索當前WordPress主題的頁尾模板檔案的。頁尾模板檔案通常用於顯示網站的版權資訊、信用或任何其他應該出現在每個頁面底部的內容。

載入頁尾模板。

包括一個主題的頁尾模板,如果指定了一個名稱,那麼將包括一個專門的頁尾。

對於引數,如果檔案被稱為”footer-special.php”,那麼指定”special”。

function get_footer( $name = null, $args = array() ) {
	/**
	 * Fires before the footer template file is loaded.
	 *
	 * @since 2.1.0
	 * @since 2.8.0 The `$name` parameter was added.
	 * @since 5.5.0 The `$args` parameter was added.
	 *
	 * @param string|null $name Name of the specific footer file to use. Null for the default footer.
	 * @param array       $args Additional arguments passed to the footer template.
	 */
	do_action( 'get_footer', $name, $args );

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

	$templates[] = 'footer.php';

	if ( ! locate_template( $templates, true, true, $args ) ) {
		return false;
	}
}

常見問題

FAQs
檢視更多 >