The get_footer() WordPress PHP function is used to load the footer template for a theme, or if a name is specified, a specialized footer will be included.
Usage
get_footer($name, $args); // your custom code here
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
Load the default footer
This example demonstrates how to load the default footer template.
get_footer();
Load a specialized footer
This example shows how to load a specialized footer named “special” from the “footer-special.php” file.
get_footer('special');
Pass arguments to the footer template
This example demonstrates how to pass additional arguments to the footer template.
$args = array( 'color' => 'blue', 'position' => 'fixed' ); get_footer(null, $args);
Check if a specialized footer exists before loading
This example shows how to check if a specialized footer exists before attempting to load it.
if (locate_template('footer-special.php') !== '') { get_footer('special'); } else { get_footer(); }
Load a specialized footer based on a condition
This example demonstrates how to load a specialized footer based on a condition, such as a specific page or post type.
if (is_page('about-us')) { get_footer('about'); } else { get_footer(); }