Let’s talk about how I found the event name to use to turn the editor back on again in the previous video. Then you’ll look at WordPress Core to see where and how it turns off the editor for the specific Posts Page. You’ll also look at WordPress Core for the function remove_post_type_support. It’s time to reverse engineer WordPress Core.
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.
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
Remove Genesis Page Title
In this episode, you will unregister the Genesis page title. Remember, you need to unregister it after it has been registered. Huh, what does that mean? It means after the theme is called. In this episode, you will learn about how to unregister callbacks and the WordPress event after_setup_theme. WordPress Events (Hooks) Psst, events, unregistering, and registering is fuzzy for you, make sure you take the Introduction & Registering Events hands-on lab. [/infoxbox]
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.
Let’s Look at add_filter in Core
Let’s look at add_filter in WordPress Core. You will find it in the wp-includes/plugin.php file. Here is a link to core trac.
Introducing Filter Event
Let’s start with registering a callback from your Starter Plugin to the post title, i.e. the_title event. You will learn more about namespaces and the full qualified name of your callback. In this video you will learn and see the following: Actions and filters are both stored in one lookup table, i.e. $wp_filter. The lookup table is a large, multi-dimensional array. The priority is the main key for each event and they are sorted. You can set the priority of when you want your event to fire. However, you can’t set the granular sub-priority level within the priority. For example, […]