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”]  

 
[gravityform id=”1″ title=”False”]  

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

Why no ads?

Hi, my name is PK, and welcome to my website, almost inevitable design. I maintain and publish 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 product better content.

Any bit of interest helps. Even sharing with your feidns, 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!

The Web Design Space

TWDS is my web design agency. If you're looking for premium quality, reliable, web design and development, come see what we're about!
Learn More
Choose "Paythen" at checkout for an interest free 10 week payment plan.
Leave a Reply

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

    New tutorials