Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Taxonomy Label Generator
Lab: Add a FAQ Feature to the Collapsible Content Plugin – Part 2
Video Runtime: 14:23
What if you had multiple taxonomies? Think about that. What if you needed to add a “topic” and “faq-categories” for example? Using the current code, you’d copy the label generation code and copy it into the next taxonomy you are registering. That’s a lot of code.
Instead, let’s build a label generator. Then you can call this function for any of your custom taxonomies. The code remains the same. The only thing that changes, typically, is the specific name.
Why do this? It makes your code more readable and reusable. It speeds up your development time and reduces your costs. It’s less code to maintain. That’s the sweet spot, i.e. where you are reducing the lines of code and making it readable, reusable, and maintainable.
Quality Code Tip
Focus on writing your code to be readable, reusable, and maintainable. When you do, it will significantly reduce the time it takes to build your code and maintain it over its lifecycle. Building code in a modular and configurable pattern allows you to pick it up and reuse it again and again with minimal effort on your part.
Quality code saves you money and time! Period.
PHP Lesson – Embedded Variables in Strings
In this episode, you’ll learn about PHP string builder using embedded variables. I’ll explain how this code works:
__( "New {$singular_label} Name", FAQ_MODULE_TEXT_DOMAIN );
Notice, the double quotes that wrap the string. Notice the variable is embedded within the string and is wrapped within curly braces.
You will grow in this profession when you incrementally and systematically stretch yourself....bit-by-bit.
Episodes
Total Lab Runtime: 05:11:56
- 1 Lab Introductionfree 07:51
- 2 Planning it Outfree 11:05
- 3 Module Architecturepro 17:12
- 4 Build the Basic FAQ Custom Post Typepro 06:04
- 5 Configuring the Custom Post Type Labelspro 18:33
- 6 Configuring the Custom Post Type Feature Supportspro 07:23
- 7 Configuring the Custom Post Type Optionspro 11:27
- 8 Flushing the Rewritespro 09:44
- 9 Planning the Taxonomypro 04:54
- 10 Build the Taxonomypro 05:33
- 11 Taxonomy Label Generatorpro 14:23
- 12 Flush Rewrite Rules - Taxonomypro 05:36
- 13 Architecting the Archive Pagepro 11:14
- 14 Serve Archive Template from the Pluginpro 10:41
- 15 Let Theme Override Our Archive Templatepro 21:29
- 16 Build the Archivepro 11:09
- 17 Build the Archive Viewspro 13:23
- 18 Set the Order Within the Topicpro 03:44
- 19 Review and Commit Changespro 02:34
- 20 Architect the Shortcodepro 15:23
- 21 Build the Shortcode - Single FAQpro 21:19
- 22 Fixing the Architecturepro 08:00
- 23 Define a WP_Query for Topicpro 16:10
- 24 Continue Building the Shortcodepro 11:39
- 25 Finish by Topic Shortcodepro 08:51
- 26 Planning the Refactorpro 08:01
- 27 Refactor FAQ Modulepro 19:58
- 28 Test, Fix, Commit, and Wrappro 08:36