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.
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 […]
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.
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.
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, […]
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.
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.
There are two main principles which will accelerate your career in this profession: fundamentals and clean, quality coding techniques. Mastering these, incrementally building yourself up and incorporating them into your workflow and code will make you more in demand and marketable. Why? Why is clean, quality coding so important? Clean code means quality. You are increasing the quality of the product you are producing. Why? By breaking up your code into modules, having a function do just one thing and behavior, purposefully naming variables and functions, and making your code more readable, you are reducing the maintainability costs of code. […]
In software and programming, you hear the term packages and modules. It’s a principle and pattern of how we group code into like functionality, features, and components. In blogging, we group like content with categories to identify a central message. It’s similar in programming, where you take the web page and break it down, grouping like items together and then building the module for each of them. Modular programming is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired […]
Let me introduce you to this lab, what you will be actively building, as well as the concepts that you’ll be learning.