Join Morten Rand-Hendriksen for an in-depth discussion in this video Techniques covered in this course, part of WordPress Developer Tips: DRY Development.
- Before we get started, let me give you a quick overview of what is covered in this installment of WordPress Developer Tips. We'll be talking about DRY development techniques, and specifically how they apply to theme development. And at the core of DRY development techniques, you will find conditional tags. These are the functions that allow us to specify under which circumstances a function or a file is brought in and rendered by the browser. And WordPress has lots of conditional tags to work with. So we'll take a closer look at where you can find them, and also, how you can use them.
Next, we'll look at the default DRY functions in WordPress, because out of the box, Wordpress allows you to use a series of functions to easily pull in different components and display them across all the templates within your theme. These functions are built into WordPress to make the code base leaner, and by understanding how to use them, you can also make your themes more effective. And you'll also understand how themes fit together. To wrap things up, we'll look at how you can move repeated code, either to separate files, or to separate functions.
And then pull call that code when you want to, thereby creating a truly dry environment, where you only write the code once, but can use it several times throughout different templates. Now that you know what's covered in the course, let's dive in to some DRY development techniques.
Find more information in the WordPress Developer Tips course.