WordPress get_footer() Function

Beginner
4 min read
Updated: Nov 2026
3 examples
Template loader

Definition

In WordPress, get_footer() loads the theme footer file. By default it loads footer.php.

If you pass a name, such as get_footer( 'shop' ), WordPress looks for footer-shop.php first. If that file does not exist, it falls back to footer.php.

Syntax

Call it at the bottom of a template file.

WordPress
<?php
get_footer();
// or a named footer:
get_footer( 'shop' );
CallWhat it does
get_footer()Loads footer.php.
get_footer( 'shop' )Loads footer-shop.php, then footer.php if it is missing.
get_footer( null, $args )Loads footer.php and passes data to it.

Remember to call wp_footer() inside footer.php.

Full declaration
WordPress
get_footer( string|null $name = null, array $args = [] ): void|false

Parameters

ParameterDescription
$namestring|null. The name of a special footer. Default is null.
$argsarray. Extra data for the footer file. It is available as $args inside it. Default is an empty array.

Return Value

Return ValueDescription
void|falseThe footer is loaded. It returns false if no footer file was found.

WordPress Examples

Three short theme examples. Each one shows the code and what it prints.

Example 1 — Load the default footer

End a template with the footer.

WordPress
<?php get_header(); ?>
<main>Page content</main>
<?php get_footer(); ?>

How It Works

  1. get_header() loads the top of the page.
  2. Your content goes in the middle.
  3. get_footer() loads footer.php.

Example 2 — A footer for the shop

Use a special footer on shop pages.

WordPress
<?php get_footer( 'shop' ); ?>

How It Works

  1. The name is joined to footer- and .php.
  2. WordPress looks for footer-shop.php first.
  3. It falls back to footer.php if needed.

Example 3 — Pass data to the footer

Tell the footer to hide the widgets.

WordPress
<?php get_footer( null, array( 'show_widgets' => false ) ); ?>

<!-- in footer.php -->
<?php if ( ! isset( $args['show_widgets'] ) || $args['show_widgets'] ) : ?>
  <?php dynamic_sidebar( 'footer-1' ); ?>
<?php endif; ?>

How It Works

  1. The second argument is an array of values.
  2. Inside footer.php, the array is called $args.
  3. The footer can now change what it prints.

Frequently Asked Questions

It loads footer.php from your theme, or a named footer file if you pass a name.
WordPress looks for footer-shop.php. If it is missing, it loads footer.php.
Your footer.php probably does not call wp_footer() before the closing body tag.
Yes. Pass an array as the second argument. It is available as $args in the footer file (WordPress 5.5 and later).

Next: get_header()

Load header.php or a named header file such as header-home.php.

get_header() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

7 people found this page helpful