The fourth strategy is to encapsulate the functionality and abstract it away to a reusable function within your child theme. Let’s do this together. While you could add this function to your child theme’s functions.php file, it’s better to build your theme’s in a modular format. Best Practice – Modular Approach Using a modular approach, you will create a folder in the theme’s lib folder and call it structure. Then in the {child theme}/lib/structure folder, create a new file called footer.php. Here is the code that removes the site footer for each of the pages that you specify: You’ll need […]
Labs
Labs are hands-on coding projects that you build along with Tonya as she explains the code, concepts, and thought processes behind it. You can use the labs to further your code knowledge or to use right in your projects. Each lab ties into the Docx to ensure you have the information you need.
Each lab is designed to further your understanding and mastery of code. You learn more about how to think about its construction, quality, maintainability, programmatic and logical thought, and problem-solving. While you may be building a specific thing, Tonya presents the why of it to make it adaptable far beyond that specific implementation, thereby giving you the means to make it your own, in any context.
Strategy 3: Remove All Genesis Footer Actions
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: 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. […]
Strategy 2: Remove the Individual Genesis Footer Actions
Strategy 2 will remove the individual Genesis callbacks (hooks) for the site footer. It requires you to create a home.php file in your child theme. This is the file that is called for the Posts’ Page. (If that doesn’t make sense, then you need to go do the Front Page vs. Home Page lab.) Now inside of this new template file, this new PHP file, you will add the individual Genesis callbacks to unregister each of them. Let’s go into the Genesis framework and find each of the hooks. Open up genesis/lib/structure/footer.php. Scroll down and find each of the site […]
Lab Introduction
Let me introduce this hands-on code building lab to you. You and I are going to build this lab together. Our goal is to remove the site footer from your Genesis child theme. We’ll build four (4) different implementations which accomplish virtually the same result. We’ll talk about the pros and cons of each strategy and when to use one over the other. It’s best that you do this lab with me. You will learn more when you actually write the code, explore the Genesis framework with me, and see what happens as you make changes. Instead of just watching […]
Remove the Genesis Site Footer on Home Page
Let’s remove the default Genesis site footer on the posts’ page, i.e. the home page. In this hands-on lab, you will walk through four (4) different implementations, each of which removes the site footer. You’ll discover the pros and cons of each of these approaches. From this exercise, you’ll be able to select the best approach for your specific needs.
2 Timing Mistakes When Removing a WordPress Callback Hook
You want to remove some callback hook in WordPress. You keep trying, but it’s not working. Argh, why isn’t it working? Did you know that timing is important? There are two (2) common timing mistakes when removing (or attempt to remove) a WordPress callback hook. Let’s explore these timing mistakes and then give you some strategies to master the remove process every single time.
Hooking into WordPress: What the Heck is a Hook?
Actions. Filters. Events. Hooks. You read about these terms all the time in tutorials and codex. You see code snippets with add_action, add_filter, and apply_filters. What the heck is a hook? What does it do? And why should you care about learning the event management system in WordPress? Stop pulling your hair out and give me a few minutes of your time to explain it in layman’s terms.
Unregister Default Genesis Callbacks
NOTE: There is currently NO VIDEO for this episode. At this point, you have the child theme loading before the Genesis framework. When you need to unregister default callbacks, nothing is going to happen. Why? Because Genesis has not loaded yet. Therefore, the callbacks are not registered in the WordPress event registry table. They get registered when Genesis runs add_action or add_filter. You need to make a change then to adjust the theme.
How to Disable Post Title Link in Genesis – in One Line of Code
In today’s quick tip, I’ll show you how you how to disable the default behavior of making the post title linkable (clickable) in Genesis. And you’ll do it in just one line of code. You’ll also see some helper utility functions available to make your job easier…right out of WordPress core.
Reordering Hook Not Working on the First Post – Problem Solving Lab
In this Problem Solving lab, your website is broken, as the first post in the loop is exhibiting unexpected behavior. You want to reposition the post info (i.e. date and author’s name) above the title. It works on all of the posts except the first one. Why? In this active, hands-on lab, you and I will walk through how to find the root cause, why it’s happening, and then how to resolve it.