The next step is to evaluate all of the contributing factors in order to determine where to start testing. Ok. It requires first that we figure out how the code is working, or how we think it’s working. In this episode, I’ll walk you through the process, explain the code, and give you a refresher on the event registry system that the WordPress Plugin API provides. Now if you haven’t already gone through the event registry videos, you need to do that now. Here are the links to get you up to speed. Please note: It is vital that you […]
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.
Identify the Expected vs. Actual Behavior
The first step in my four-step problem-solving process is to identify the expected versus actual behavior. You simply write down everything that you see which is different from what is working versus what is not working, as well as what you expected to occur versus what actually occurred. It’s literally a process of pulling out your notebook and writing down the differences. Even the most minute detail needs to be recorded. Why? Because it may be a clue to help you find, understand, and resolve the true root cause. In this episode, you and I will walk through this process […]
Lab Introduction
Let me introduce you to the lab and what you will be doing. This lab starts with a broken website as some wonky, unexpected behavior is happening. You will be walking through the problem-solving process of how to identify the root cause, why it’s happening, and then how to resolve it…properly. In doing so, you will dive into the Genesis framework and WordPress’ Plugin API.
Quick Explanation
Hey not a member? That’s ok. Here’s the free video that tells you what is wrong and provides a brief explanation as to why. Porter originally asked me the question. This video addresses his question and uses his example to explain why the problem is occurring.
WordPress Event (Plugin API) Refresher
Genesis gives us the means to fully customize it because it utilizes the event system available from the WordPress Plugin API. Throughout the codebase, you unregister events to remove a component, register your callback to change something, or re-register an event to change its order or location. You need a solid understanding of the Event Registry system in order to customize Genesis. Let’s do a refresher here. You can accelerate your proficiency with the Plugin API using these video-based Docx as they thoroughly walk you through each construct: add_action remove_action add_filter remove_filter do_action apply_filters
Sanitize with get_post
Let’s go into WordPress Core to understand if we can use get_post to sanitize fields when in display filter mode. You will reverse engineer Core to discover for yourself. You will use has_filter to see if there is a filter event that does the sanitizing for the data post_content. You’ll also learn about foreach.
PHP Argument Lookup Table
Let’s go deeper to understand what happens when arguments are passed to a function. How does PHP manage them? If you pass more arguments than a function needs, what happens? How do you access them? The following PHP constructs were presented to you in this video: func_get_arg and func_get_args.
Number of Arguments to Pass to the Callback
The last parameter for registering your callback to the event is the number of arguments. It specifies the number of arguments your callback wants to receive. You will learn about the difference between required and optional parameters in PHP. You’ll see what happens when you send too few and too many arguments to your callback.
WordPress Event Priority Level
Let’s see what the priority level parameter does. How does it affect the order of code execution (i.e. when code is called and works)? With a filter, what is the order to changing the value that is passed to each of the callbacks?
WordPress Event Lookup Table
You will meet the WordPress Event Lookup Table, which holds all of the events. Yup, it holds both the filters and actions all in one event lookup table. In this video, you will look at the actual table and we’ll discuss how it is structured including the event name, priority, callbacks, and the number of arguments.