From the course: WordPress Developer Tips: DRY Development

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Using functions

Using functions - WordPress Tutorial

From the course: WordPress Developer Tips: DRY Development

Start my 1-month free trial

Using functions

- So far, I've shown you how you can take large blocks of code like the content block or a sidebar or header and break them out into individual files and then call them back in again, using either the default DRY methods: get header, get sidebar, and get footer, or the custom function get template part. Now this is all part of DRY theme development in Wordpress but it's not the only DRY technique you're going to be using. Another DRY technique that's really useful is the ability to create custom functions and then call in the custom functions when need be. The reason why you may want to create a custom function is either because you want to alter the output of an existing function or because you are simply creating something that doesn't really belong in its own file. The practice that's been developed by the underscores theme and is applied to the underscore's theme and any theme that's built on top of underscores is to place all such custom functions in a file called template tags…

Contents