get_footer

Sponsored Link

現在のテーマディレクトリからfooter.phpテンプレートファイルをインクルードします。もし、名前が特殊な場合は、特殊なフッダーとして、 footer-special.phpがインクルードされるでしょう。
テーマにfooter.phpファイルがない場合、フッダーはデフォルトテーマのwp-content/themes/default/footer.phpからインクルードされるでしょう。

Sponsored Link

Includes the footer.php template file from your current theme’s directory. if a name is specified then a specialised footer footer-special.php will be included. If the theme contains no footer.php file then the footer from the default theme wp-content/themes/default/footer.php will be included.

get_footerのテンプレートタグ使用方法

<?php get_footer( $name ); ?>

get_footerのパラメーター

$name

(string) (optional) footer-name.phpを呼びます。

(string) (optional) Calls for footer-name.php.

デフォルト:なし

Default: None

シンプルな404ページ

The following code is a simple example of a template for an “HTTP 404: Not Found” error (which you could include in your Theme as 404.php).

<?php get_header(); ?>
<h2>Error 404 - Not Found</h2>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

マルチフッター

別のページに別のヘッダー。

Different footer for different pages.

<?php
if ( is_home() ) :
  get_footer('home');
elseif ( is_404() ) :
  get_footer('404');
else :
  get_footer();
endif;
?>

備考

*名前パラメーターはバージョン2.7から追加されました。

* The name parameter was added in Version 2.7.

変更ログ

Since: 1.5.0

ソースファイル

get_footer()は、wp-includes/general-template.phpに位置しています。

get_footer() is located in wp-includes/general-template.php.

関連テンプレートタグ

get_header, get_footer, get_sidebar, get_template_part, get_search_form, comments_template

Sponsored Link