Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Strategy 3: Remove All Genesis Footer Actions
Lab: Remove the Genesis Site Footer on Home Page
Video Runtime: 03:09
Strategy 3 removes all registered event callbacks. Using remove_all_actions()
, you are removing or unregistering every single pre-registered event (hook) callbacks. Using this approach, our code then is:
<?php | |
/** | |
* Posts Page (Home) template | |
* | |
* @package KnowTheCode | |
* @since 1.0.0 | |
* @author hellofromTonya | |
* @link https://KnowTheCode.io | |
* @license GNU-2.0+ | |
*/ | |
remove_all_actions( 'genesis_footer' ); | |
genesis(); |
When to Use This Approach?
This approach ensures that all of the callbacks are unregistered. It ensures that any callbacks outside of Genesis are removed. Why is that important? It ensures there are no wonky or weird renderings in the browser from your theme or plugin.
Strategy 2 removed the defaults from the Genesis framework including the opening HTML <footer class="site-footer">
, the contents of the site footer, and the closing HTML </footer>
element. What if there are other callbacks registered to the same genesis_footer
event (hook)? Strategy 2 does not remove them. Aha, but Strategy 3 does.
This is the best strategy for the majority of your use cases. Why?
- It’s a single line of code
- Ensures that all site footer callbacks are removed
- It targets specifically the Posts’ Page by using the
home.php
template file - It’s clear as to your intent, which increases maintainability of the code.
What if I need it on another page?
If you want to remove the site footer say on the Front Page, you can create a front-page.php
file and copy this code into it. It’s a simple solution that is reusable.
If you listen carefully, you can hear the 1s and 0s flowing in your computer.
Episodes
Total Lab Runtime: 00:33:41
- 1 Lab Introductionfree 02:35
- 2 Strategy 1: Hide it with CSSfree 06:17
- 3 Strategy 2: Remove the Individual Genesis Footer Actionspro 05:30
- 4 Strategy 3: Remove All Genesis Footer Actionspro 03:09
- 5 Strategy 4: Reusable Functionpro 11:18
- 6 Which One to Use?pro 04:52