The get_footer() WordPress PHP function loads the footer template for a theme, or a specialized footer if a name is specified.
Usage
get_footer( $name, $args );
Example:
Input: get_footer('special', array('key' => 'value'));
Output: Loads footer-special.php with the additional arguments.
Parameters
- $name(string) – Optional. The name of the specialized footer. Default: null
- $args(array) – Optional. Additional arguments passed to the footer template. Default: array()
More information
See WordPress Developer Resources: get_footer()
Examples
Multi-footers
Using different footers for different pages.
if ( is_home() ) {
    get_footer('home');
} elseif ( is_404() ) {
    get_footer('404');
} else {
    get_footer();
}
The file names for the home and 404 footers should be footer-home.php and footer-404.php, respectively.
Named footer template
Load an alternate footer file by using the $name parameter.
get_footer('special');
This code in a theme file will load the template file: footer-special.php. If not found, it will default to loading footer.php.
Pass additional arguments to the footer
Create a footer-new.php file in the theme’s main directory and put this code:
echo $args['name'] . "<br>"; echo $args['location'];
Then, put this code in a template file like index.php:
get_footer('new', array('name' => 'John Doe', 'location' => 'USA'));
Output: John Doe<br>USA
Simple 404 page
A template for an “HTTP 404: Not Found” error to include in your theme as 404.php.
get_header(); echo "<h2>Error 404 - Not Found</h2>"; get_sidebar(); get_footer();
Load a footer with a custom CSS class
Add this code to the footer-custom.php file in the theme’s main directory:
echo '<div class="' . $args['css_class'] . '">This is a custom footer.</div>';
Then, use the following code in a template file to load the custom footer:
get_footer('custom', array('css_class' => 'my-custom-footer'));
Output: <div class="my-custom-footer">This is a custom footer.</div>