Home Tutorials Where Exactly Should You Place wp_footer()?

Where Exactly Should You Place wp_footer()?

Author

Date

Updated on

Category

The wp_footer() function is often used by plugins to insert PHP codes after everything else on your page. According to WordPress.org theme development documentation, you should place the wp_footer() function in the footer, which would be in the footer.php file.

One detail that WordPress.org doesn’t mention is that most plugins (i.e: Spam Karma 2, PodPress, and FireStats), using the wp_footer() function, tend to break your theme. A well-designed and well-built theme is nothing without a safely placed wp_footer() function.

Here’s my advice. Don’t place the wp_footer() function right before the end; that’s usually the closing body tag. Instead, place that function within a DIV or container. For example:

<div id=”container”>

Posts

Sidebar

<?php wp_footer(); ?></div>

If you do that, no matter what a certain plugin does to the footer of your theme, it doesn’t expand beyond the container or DIV containing the wp_footer() function. You can open up the footer.php file of the Greed theme for an example.Update:
Place the wp_footer() function within a style-less container (usually the outermost div with no backgrounds and images) that your layout doesn’t depend on. Otherwise, you might end up with an incomplete layout while waiting for a slow loading plugin.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Recent posts

LawBlog WP Theme Review

Regardless of which area of law you practice, it’s imperative that you have proper online representation. You need to give your customers a feeling...

The Deeper Meaning and Purpose Behind Shapes in Web & Graphic Design

Sometimes in web design, a clean website is often the best choice for certain clients. Instead of elaborate backgrounds or too many aesthetic choices,...

How to Easily Design a Website Without Coding

Are you looking to build a website and you don’t know how to code? Online web design services are helpful to create website templates...

The importance of SSL Certificates as part of a web hosting package

Building a successful business requires trust, and gaining trust can be difficult especially when you run a business where it is taken for granted...

How Can Domain Name Extensions Influence Your Brand Name?

Are domain name extensions important in naming your brand? The shortest answer is "Yes." In today's online world, it is the first thing that...

Recent comments