Divi Tutorial – Disabling Footer on Front Page

Divi Tutorial – Disabling Footer on Front Page

On a Facebook Divi community, I saw a question:

How do I hide the footer ONLY on the front page?

That sounded simple enough.

So I replied with a simple css fix from my phone:

In the page-specific custom css section, add

#main-footer {display: none;} 

here:

Of course, that worked. A simple, dirty method.

Case closed?

However, Raphael Sanchez brought up a valid argument.

It’s not good to fully render an element and then just hide it.

(I’m paraphrasing here)

and yes, that is a good argument.

Warning: From this point on, I advise you to use a child theme 100%. No excuses. If you need a good Divi child theme click here.

So, I suggested using a php if clause..

I guess Raphael was thinking the same thing because he came back with this:

(the comments were slightly edited for clarity, also the original code had an OR, I had to change it to an &&)

Now, the thing is, the code above is just an example. It’s not the actual code for Divi’s footer.

So, taking Divi’s footer.php, and adding another idea:

(Note: I left the bottom credits section because without it, it would look weird. If you use a blank template, it’ll disappear because that’s what the blank template does.)

If you’re not going to use the “blank page” template anyway, then change your footer.php to this:

If you do use the “blank page” template, then change your footer.php to this:

So there you have it. Have fun!

Note:
If you want to learn how to add custom footers, click here.

 
[sc name=”learn css”]
 
[sc name=”podcast”]
 

 

 

Code credit: Raphael Sanchez
(Although we were brainstorming methods to do this and we both came up with the idea around the same time, Raphael posted the pen, and I’m using it with his permission, so he gets 99% of the credit.)

Photo by Vicko Mozara on Unsplash

Get Breakdance

Breakdance is, in my opinion, the best page/site builder on the market, which is why all my tutorials use Breakdance. It's also why I have an affiliate link. You don't pay extra, but I get a little commission, so it helps support the site. Thanks!

Get ACF Pro

Another essential plugin for site building. This isn't an affiliate link, it's just for convenience.

Get WP Codebox Pro

If you'd like an easier to use, and more advanced code management plugin (instead of just editing and making files yourself) then WP codebox pro is for you. Adding php, js, and even SCSS. Pretty nice! Affiliate link below.

Blank Plugin

Sort of blank. It's made to be easy to use with the tutorials. Download and edit any way you see fit.
    Leave a Reply

    Your email address will not be published. Required fields are marked *

    New tutorials

    Designing Beyond the Brief
    Disable Gutenberg Editor on some ACF pages
    ACF flexible content fields in Breakdance 2.4
    Making a lightbox from a CPT Loop

    Got a question? ask!

    If you have any question about the content on this page, feel free to send me an email by clicking the button below.

    newsletter? sign up!

    Sign up to the newsletter for updates on tutorials, news, and offers.

    Join the cypher!

    An awesome membership program for Breakdance Builder users coupled with an inclusive, friendly community.

    Got a question?

    If you have a question about something on this page, send me an email, and hopefully I can answer, and we can solve it!