Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am working on developing a plugin, and I am trying to add a line of text to the bottom of the page, I see there are two actions that seems reasonable, wp_footer() and get_footer(). wp_footer sounds like it may more suited towards code that needs to go at the very end of the page (like JavaScript files), but get_footer didn't have any documentation on its wordpress codex page. Which should I use for something like this?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

These two functions accomplish two different things. wp_footer() is a hook used in your footer.php template file to ensure that the right code is inserted (from the core/plugins/etc) into the right place. get_footer() is used in your other template files to call for the code in your footer.php template file.

So in simpler words wp_footer() gets other code that you most likely don't produce (but need), so it's a little more abstract. get_footer() grabs the exact code that you wrote into your footer.php file so it is the WordPress version of PHP's include() function.

Hope this helps :)

share|improve this answer
add comment

The get_footer() template tag is a custom wrapper for the locate_template() function, used to include a template-part file within a template file. The get_footer() template tag is part of the WordPress template system, and is used primarily by the Theme itself, to specify the footer.php or footer-{slug}.php file to include in the current template.

The wp_footer() template tag is a custom wrapper for the wp_footer action hook, which is invoked via do_action( 'wp_footer' ). The wp_footer() template tag is part of the WordPress Hooks API, and is used primarily by Plugins, to inject scripts in the site HTML footer.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.