Let’s talk about what the modular part of ModularConfig is. How do you design your code to be modular? What does it mean?
The de facto in WordPress is to use snippets and boilerplates. This lab introduces you to the modular approach.
Boilerplates give you a code structure or template. Then you edit the code to change the implementation. You may go to a website, fill out a form, and then that site automatically edits the code’s boilerplate to change it for you out of convenience. But the code is being changed to fit your project’s implementation.
Snippets are tiny snippets of code to do something. You may have a snippet of code to make a Genesis theme default to a full-width layout. Or maybe you have one that makes something sticky. These are a small chunks of code that gives you a segment of a feature or task.
Module is a pre-built, well-tested, and ready to go standalone feature. It’s a complete module of code that does a specific feature such as a FAQ, custom post type generator, loads archives and templates from a plugin, settings handler, and more. These are highly specific features or enhancements that do not require you to change the codebase.
When you change the codebase within a boilerplate or snippet, you are changing the code. It’s no longer well-tested. Rather, you changed it. The risk of conflicts, errors, bugs, and/or wonky behavior increases.
The modular approach seeks to minimize your time to integrate it into your project.
In your mind, think about how a house is built. Look around the building where you are now. Do you think every single component in that building is made onsite as the building is being built? No. Rather, components are prebuilt and then shipped into the site to be assembled. Then the craftsman customizes those areas that need it. That’s what you do as a web developer.
Let’s go deeper. Look at the windows. Those are premade and shipped to the construction site. Look at the roof structure. The trusses are premade and shipped in to be placed and assembled. The kitchen cabinets are premade at the factory and then shipped to the site. All of these are modules. Premade. Prequalified and tested. Ready to be integrated and installed for use.
Imagine if the craftsman had to cast the tub, door hardware, fixtures and more. Then they build the door from raw wood. Then they form the glass for the windows, cut, sand, and build the framing, and inject the gas in-between the panes. Imagine how long and costly construction would be. But to reduce errors and costs, these items are premade. You buy the door, window, cabinets, roof trusses, etc kits. Then the craftsmen installs those components.
Think about it. When installing windows, they don’t go in and modify the window. Right? They don’t cut the casing and then cut the glass to fit it to the hole. Nope, it’s a prebuilt window that is installed. For the bathtub or doors, they don’t make those from raw materials onsite. They don’t customize them either. Rather, they install them into the home/building.
You get WET when you swim. Stay DRY when you code.
Total Lab Runtime: 06:04:21
- 1 Lab Introductionfree 07:43
- 2 What is Reusable?free 18:07
- 3 Modular in ModularConfiguration Architecturepro 15:12
- 4 Configuration in ModularConfiguration Architecturepro 12:31
- 5 Creating Configuration Repositorypro 05:14
- 6 Planning it Outpro 12:26
- 7 Build the FAQ Custom Post Type Configpro 09:10
- 8 Loading the Config Filepro 04:29
- 9 Building Custom Post Type Generatorpro 12:24
- 10 Generate Post Type Supported Featurespro 16:41
- 11 Generate Post Type Labelspro 14:45
- 12 Test it Outpro 16:26
- 13 Custom Post Type Generator - Registrationpro 13:33
- 14 Rewrite Rulespro 14:05
- 15 Reusable Rewrite Rules Handlerpro 08:15
- 16 Custom Module - Embed or Standalone?pro 07:22
- 17 Build the Topic Taxonomy Configpro 06:58
- 18 Reusable Taxonomy Generatorpro 10:19
- 19 Auditing the Custom Labelspro 18:10
- 20 Refactoring the Label Generatorpro 09:32
- 21 Specify Certain Labels Optionpro 10:10
- 22 Link the FAQ into the Taxonomy Generatorpro 10:28
- 23 Move Config to FAQ Modulepro 04:58
- 24 Test the Taxonomypro 13:30
- 25 Plan out the Shortcodespro 09:25
- 26 Starting the Shortcode Boilerplatepro 14:53
- 27 Build the Shortcodes Configurationspro 15:30
- 28 Registering Shortcode with Custom Modulepro 18:54
- 29 Shortcode Configuration Storepro 08:25
- 30 Test the Shortcodespro 11:32
- 31 Wrap it Up, Review, and Commit Changespro 13:14