do_action( 'get_footer', string|null $name, array $args )

Fires before the footer template file is loaded.


Parameters Parameters

$name

(string|null) Name of the specific footer file to use. Null for the default footer.

$args

(array) Additional arguments passed to the footer template.


Top ↑

Source Source

File: wp-includes/general-template.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
5.5.0 The $args parameter was added.
2.8.0 The $name parameter was added.
2.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Collins Mbaka

    The following example will display a script conditionally for a different footer. This is just one example of how you may use the hook and will use a secondary template file of footer-new.php

    function themeslug_footer_hook( $name ) {
    	if ( 'new' == $name ) { ?>
    		<script>
    			(function($) {
    				//put all your jQuery goodness in here.
    			})(jQuery);
    		</script>
    	<?php
    	}
    }
    add_action( 'get_footer', 'themeslug_footer_hook' );
    

You must log in before being able to contribute a note or feedback.