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.
Make it More Performant & Wrap it Up
In this episode, I explain why the previous solution is not as performant (as fast) as it could be. I show you why it’s not as fast. Then you will refactor the code to make it faster. You will see the results for yourself. Once you refactor, then bam, you completed this lab! WooHoo! Excellent
The Root Cause
Now you understand the clues and what they are telling you. Let’s identify the root cause and discuss the why of it. Why are the callbacks out of order on the first post in the loop? In this episode, you should have a huge “Aha” moment where it just makes sense to you. Then you are going to resolve the root cause by changing the code. Woot! If you need to brush up on variable scoping, here is the link to the PHP Variables Bootcamp.
Analyzing the Clues
At this point, the clues are telling us about the anomaly. Do you see it? The data you see in your browser is clearly telling you “Hey Silly, the problem is right here.” Let’s see if you can figure out what the root cause is from the clues at this point in the lab. It’s time to analyze the clues. In order to understand what they are telling you, first, you need to visualize in your mind the order in which things are happening in the code, how PHP is executing, and when stuff is getting put into the Event […]
Fine-Tuning Our Tests
Now it’s time to stop and assess what our first tests told us. What clues did it provide? Let’s take a look at the data it reported in the WordPress event registry table. From this exercise, you will fine-tune the tests to get closer to finding the root cause. You will repeat the problem-solving steps.
Putting in Our First Tests
In this episode, you and I will figure out what we want to test first. Then we’ll walk through and discuss what WordPress is telling us.
Evaluate the Contributing Factors – Part 2
As the last episode was running long, I split it up into two videos to give your brain a rest. This is part 2 of evaluating the contributing factors. In this episode, we are narrowing in on what we want to test to prepare ourselves for the next episode and step.