The feature from the product backlog says that we need to develop a shortcode that embeds a single FAQ or a group of FAQs by a single topic. Hum, how are we going to accomplish this with one shortcode? We can use the user-defined attributes to let the author tell us which one to process. We can do the following:
Therefore, we are building a
faq shortcode with two different user-defined attributes:
How are we going to process these two different requests?
For the single FAQ, we get the post ID. Therefore, we can use
get_post to go grab the post that we want and then process using it.
For the topic request, we need to go grab all of the FAQs for the specified topic slug. We have multiple ways to do this, but let’s use WP_Query and it’s tax query argument.
Let’s talk our way through the strategy and build the basic architecture. How do we want to process the different views? How do we process the different requests? Let’s talk about the architecture and strategy.
Break. Go rest your noodle for a couple of minutes.
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