Add Custom Content at the Footer Section

On my previous post, I showed how to add custom content within the <head></head> tag on your WordPress site. Today I will discuss about pretty much the same topic but my discussion will be limited to adding custom content at the bottom section (before </body> tag) of your site. Our custom function will work with the “wp_footer” function which generally get places before the </body> tag. Here is the sample snippet.

function insert_custom_content() {
   echo '<script src=""></script>'; }

This snippet will echo out the script tag just before the </body> tag. It could be a great place to add Google or any other analytical scripts as these scripts would be loaded only after the entire page is loaded (aka at the end). This way your script won’t cause any delay on rendering page and it’s other contents like text or even advertisements.

You can get creative with this snippet and add whatever you need before the </body> tag. Let me know what you are planning to do with this snippet from the comment section below. Your question, comments or suggestions are always welcome, politely please. Thank you.

Note: I didn’t discuss about the “priority level” on this post as I am thinking of writing an entire post on that issue. Stay tuned.

References: add_action, wp_footer

Today In History



Leave a Reply

Note: Convet HTML, PHP, JavaScripts from HTMLify, before posting from comment section.
License: By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution. Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.