WordPress at a glance

get_footer() WP 1.5.0

Includes the footer.php template file from your current theme's directory. If a $name is specified then footer-{name}.php file will be included.

If the theme contains no footer.php file then the footer from the default theme wp-includes/theme-compat/footer.php will be included.

Works based on: locate_template()
Hooks from the function

null|false. Void on success, false if the template does not exist.


get_footer( $name, $args );
The name of the specialised footer.
Additional arguments passed to the footer template.
Default: empty array


#1 Simple 404 page

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

#2 Multiple Footers

if ( is_home() ) :
elseif ( is_404() ) :
else :

The file names for the home and 404 footers should be footer-home.php and footer-404.php respectively.


Since 1.5.0 Introduced.
Since 5.5.0 A return value was added.
Since 5.5.0 The $args parameter was added.

Code of get_footer() WP 5.7.2

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;

From category: Theme files connection

More from Template Tags: Main Functions

vladlu 100vlad.lu
Editors: Kama 100
No comments
    Log In