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

Leave a Reply

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

    New tutorials

    Why no ads?

    Hi, I'm PK, and I maintain and publish content on this site for two reasons.

    1. To give back to the community. I learned so much from people's tutorials and StackOverflow that I wanted to contribute and help others.

    2. To provide a more structured learning experience. People struggle to find the course that guides them from start to finish, based off of real life experience, and my courses provide that.

    The only "ads" I have here are for my own courses, and maybe an affiliate link, but that's it. They fund the website resources and provide more motivation for me to produce better content.

    Any bit of interest helps. Even sharing with your friends, suggesting my courses to your developer or designer, or subscribing to my YT channel, or joining our Discord. Thanks and I'll see you around!

    There's a newsletter!

    Sign up to the newsletter for the occasional updates on courses, products, tutorials, and sales.