Bummer! This is just a preview. You need to be signed in with a Treehouse account to view the entire video.
Quick Review of How to Add a Theme Setting1:18 with Zac Gordon
Now that we have done all of the coding to add a single setting, we begin talking in this video about how to keep adding more settings.
So what we've seen so
far are a number of steps needed in order to create a basic setting.
We saw that we needed to set up our basic theme initialization,
which has register_setting, add_setting_sections, and_settings_field.
We're tying that in to admin_init, and then both the section and
the fields had callback functions.
We weren't actually using the section callback here since we didn't have
anything else to necessarily add to it.
However, we have quite a bit inside of the checkbox output here,
and then finally the theme page that we had added previously.
And then finally for our actual theme page, we needed to add in the form
settings_field, do_settings_sections, and a submit_button.
So a number of steps here, but with these number of steps,
you basically have the framework to add as many settings or sections as you want.
So what we're going to look at now is now we that we have this saved in the database
and working on the back end, how do we go into our theme and
use some of these settings?
So let's take a look in the next video at how we would implement this
in our template code.
You need to sign up for Treehouse in order to download course files.Sign up