We just added hard coded headings to each of the 3 columns of category posts. In this case, this is a simple extension of Lesson 6, Using Secondary WordPress Loops in Genesis, where we put lists of posts in.
Allow End User to Choose Categories
And this is what you can accomplish if you hard code it. But rather than hard coding this query and hard coding Cherries, what we want to do is give the end user the ability to choose that themselves. So while we have our front page properly modified, we have to add Child Theme Options in order to allow the end user to choose it.
4 Necessary Functions for Adding Theme Options
Genesis has a very neat system for adding theme options. If you were to do this without using Genesis it’d be quite a bit more work but using Genesis, there are essentially 4 functions that you have to create.
You have to create a function that sets the defaults. You have to create a function that tells Genesis which of its sanitization filters you want to use with those settings. Then you have to set up the meta box and finally, you have to build the form that goes inside the meta box.
So setting up settings in Genesis is as simple as using these 4 functions to do what you want to do. If you would like a written reference I’m using pushdigital.com/custom-settings-for-genesis-child-themes.
I think a written reference can be valuable. It’s not perfect in its description of how this works but it’s not bad. The main thing is that he uses the simplest possible form set up and he doesn’t quite use it perfectly but otherwise, generally speaking, the content of this page is actually pretty good.
So we have these 4 functions that we’re doing. I’ve already done this and tested it so I’m going to open up the file that I used for that and we’re going to start off with the settings.
Genesis Theme Settings Defaults
This set up your page defaults works off of a filter called the Genesis Theme Settings Defaults and it holds all of the Genesis theme settings. For example, were going to use the WordPress get_options in a few minutes. And if you were to use the WordPress get_option Genesis settings, you would find an array of information. And that is the information that is stored in this filter, the Genesis Theme Settings Defaults.