The Thesis Options API is a simple system used throughout Thesis to create, display, save, and retrieve options.
It exists to consolidate the labor-intensive, repetitive process of getting options from the user—a problem that plagues every web software developer.
Wherever possible, Skins and Boxes should use the Options API to minimize their code, standardize their output, and enhance their maintainability.
Why Use the Thesis Options API?
If you need to get options from a user, here’s what you need to do:
- Create an administration page where the user can interact with your options
- Output the HTML
<form>
containing your options - Save options to the database when the user saves the form
- Retrieve those options at a later time to accomplish whatever it is you’re trying to do
Typically, this is a painstaking process, and it gets old quickly if you are building an application with many options and many points of interaction with the user.
But it doesn’t have to be like this. Consider:
The general structure for any options form is similar—only the values inside the form change.
Also, there are only so many types of data, so it’s plausible to have a generalized save routine that works for any kinds of options you might create.
The bottom line is that there are underlying patterns in options management, and the Thesis Options API leverages these patterns to make coding easier.
By using the Options API, you can significantly cut down on both the code and time required to create rich applications.
Even better, you can use the Thesis Options API to interact with WordPress in new and exciting ways that are far easier than working with WordPress itself.
Using the Options API
The easiest way to make use of the Options API is to use a reserved method in a Skin or Box that works with the Thesis Options API array format.
For example, Thesis Boxes contain features that utilize the Options API in extremely powerful ways, such as:
- Enabling data and HTML options for your Thesis Box
- Adding options to Thesis Skin Templates
- Creating WordPress post meta options
- Adding options to WordPress terms (categories, tags, and taxonomies)
For more information, check out the Thesis Box API documentation.
Options API Info and Tutorials
- How to Generate a Form with the Thesis Options API
- How to Save Thesis Options API Data