Next, you need to move the theme customizer files from the Genesis Sample Theme to your new developer’s theme. You’ll start by copying the files into your theme. Then you’ll start refactoring by applying the PHP namespace and removing the prefixing. You’ll give the functions purposeful names so that each tells you specifically what it does, i.e. what the expected behavior is when you call the function. You’ll be reorganizing the helper functions into a helper file. Also, there are some functions embedded within a function, which makes the code less readable. Let’s refactor those and make them their own […]
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.
Load Assets (Enqueue)
Now, you need to migrate over the scripts and style (assets). In this video episode, you will create a new asset loader file, which will handle the WordPress enqueuing process for the assets.
Genesis Structural Components
In this episode, you will move each of the Genesis structural components into their respective files. You’ll be specifying the PHP namespaces and each callback.
Refactoring Image Sizes
Your homework in the last episode was to refactor the image sizes on your own. In this episode, we’ll walk through how to move the image size name and arguments into a configuration variable. Just like the theme supports, calling the image sizes over and over again is WET and unnecessary. Let’s refactor to clean up the code and remove the redundancies.
Refactoring Theme Supports
Did you notice that the function add_theme_support() is being called over and over and over again in the setup? And did you notice that this function requires a key and then a value? I mentioned in the last episode that the final version of this starter theme will load all of the theme supports from a configuration file. Calling this function repeatedly is redundant and unnecessary. Let’s refactor it to convert the theme to clean, quality coding standard. In this episode, you will refactor the WordPress theme supports to move the parameters into a local configuration array. Then you’ll loop […]
Setup Tasks
In this episode, let’s move the setup tasks out of the Genesis Sample theme and put them into our new starter theme’s setup.php file. You’ll see two different strategies of how to load these setups. Plus you will break up each of the setups into separate functions to prepare for when you will load all of them from a configuration file.
Initialization Tasks – Directory Constants
Now it’s time to declare the directory constants for your theme. I’ll walk you through the process and explain why using get_stylesheet_directory() repeatedly is less performant (slower) than using a constant, such as CHILD_THEME_DIR or even the one built into Genesis CHILD_DIR.
Initialization Tasks – Theme Constants
It’s time to splice out the initialization code and load it into our new Genesis starter theme’s init.php file. The file loaders will go into the autoload.php file, while the constant declarations go into the init.php file. The typical way of doing the theme constants is to hard-code them such as this: Hum, but this information is already available in the theme’s style.css file. And as a matter of fact, WordPress reads that information right out of the CSS file. You can access that same information and then use it to populate your theme constants like this: In this episode, […]
Slicing Up the Sample Theme’s functions.php
Let’s walk through the Genesis Sample Theme’s functions.php file and group like tasks, as you are preparing to move them into the appropriate files in your new starter theme.
Laying Out the Theme’s Architecture – Part 1
In this video episode, you’ll start building your new custom Genesis-powered starter theme. You’ll be adding the file and folder structures. Don’t worry, Tonya will walk you through each step and explain it.