Let’s talk about the web browser. The browser is capable of storing a local copy of the assets (stylesheets, scripts, etc.). It does this to save web page load time. After the first visit to a page, the next time the person comes to the same page, it will load faster. Why? The browser doesn’t have to request those files from the server again. Nope, it kept a local copy in the computer’s cache. In this episode, you will also see how WordPress appends the version on to the end of the asset’s URL in order to make it unique […]
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.
Lab Introduction
Let me introduce you to the lab, as well as the problem you may be experiencing.
Genesis Version – Ensure Your Latest Changes Go Out to the Browser
Have you ever had the problem where you made a change, pushed it to your client’s server, and then they say they can’t see the changes? So you tell them to clear their browser’s cache and that solves the problem. In this lab, you will learn how to make sure your changes are sent out to the browser using the constant Genesis provides for you.
Let’s Build a Blog Intro Custom Plugin
Out-of-the-box WordPress does not provide a way to introduce the Posts Page (Blog), as the editor is turned off and there is no automatic rendering of the content before the posts. In this lab, you will build a Blog Intro real-world, custom plugin which provides an introduction or welcome feature for your clients. As you build this plugin, you are learning about fetching content from the database, sanitizing, the Genesis framework, views, and more.
Wrap it Up
Congratulations! You just built a custom real-world WordPress plugin. You did from scratch. While you can use this plugin for all of your projects and even extend it, this lab gave you so much more. You learned some of these valuable coding knowledge: Custom plugin – writing it from scratch Unregister callbacks Investigate a theme Genesis Sanitizing Views Database Clean code Software principles All of these, especially the last two, are essential to you as a software developer. This lab gave you knowledge and skills that you will use in everything you do. It is adaptable then to all of […]
Master Tip: How Did I Know to Use after_theme_setup
?
Let’s talk about how I knew to use after_setup_theme. You will look at in WordPress Core.
Remove Genesis Page Title
In this episode, you will unregister the Genesis page title. Remember, you need to unregister it after it has been registered. Huh, what does that mean? It means after the theme is called. In this episode, you will learn about how to unregister callbacks and the WordPress event after_setup_theme. WordPress Events (Hooks) Psst, events, unregistering, and registering is fuzzy for you, make sure you take the Introduction & Registering Events hands-on lab. [/infoxbox]
Master Tip: Why Use a View?
Let’s talk about why you want to not intermingle your business logic with the HTML. Why do you use a view? It’s based upon the proven software principles such as Separation of Concerns and Single Responsibility. APIs, frameworks, tools, and apps come and go. But these principles remain. More importantly you will learn about intent. Intent is important in all of the code that you will ever build.
Building the HTML View File
It’s time to build out the HTML structure and put it into the view. What is a view? Why do you want to use it? Let’s talk about the qualities of clean, quality code. You will also learn about how to load the view as well as the variable scope. To learn more about variable scope and including files, go to the PHP Variables Bootcamp.
Prepare the Contents for the Browser
Let’s finish preparing the content for rendering out to the browser. How about if there are shortcodes in the code? How do we process those? How about using auto-formatting the paragraph HTML elements? In this episode, you will add in the do_shortcode and then wpautop.