From the course: WordPress: Customizing Themes with Genesis
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Using query_args in a custom field
From the course: WordPress: Customizing Themes with Genesis
Using query_args in a custom field
- [Instructor] For many moons, Genesis had a documented quote unquote Easter egg that you could use in conjunction with a blog page template to get a custom loop. And this was done by creating a page and adding a custom field with the name query_args, and then assigning that field a particular value. It was an easy way to invoke a custom loop without using any code. As of Genesis 3.0, that block page template was removed. Support was added to use that query_args custom field on any page to invoke a custom loop. So here's a quick rundown of how it works. So, we are in loops.php in the Genesis framework files. And here on line 20, I've got the genesis_do_loop. So, when the loop runs, there's this conditional here on line 22 that checks whether or not the loop is being run on a single page, and whether there's a custom field with the name query_args. If so, it takes the value of that field, and passes it into an argument…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.