We want our plugin to provide a default archive template for the FAQ post type. This archive will group the FAQs by their topic and provide the HTML structure for each FAQ. We can’t expect theme developers or customizers to build this template for us. That’s not a reasonable expectation. Instead, we need to build the template and then serve it up. But WordPress does not serve templates from plugins out-of-the-box. Therefore, we will need to write the code to tell WordPress: “Hey, load this template please.” We’ll want to provide the means for the theme to override when it […]
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.
Code Tip: Specify a default for get_option()
In this quick tip, you will see that you can specify a default return value for the WordPress function get_option(). When the option does not exist in the database, such as you are setting up a theme options page, then you can specify a return value as the default. Otherwise, you will get “false” back.