Best Practice to decide when to use theme options page (simple or complex) or Customizer API
you can find the customizer demo folder include the following theme.
- have a boilerplate or awarness on how to use the customizer api in wordpress.
- you can copy the theme on your theme folder of wordpress and activate it.
- click customize and you can see the customizer on the left.
- Define a Section
- Adding a Setting
- Add a Control
- Write the Javascript
- Make the call to
get_theme_mod
you can find the theme option demo folder include the followign theme.
- have a boilerplate or awarness on how to use the theme options (settings api) in wordpress.
- you can copy the theme on your theme folder of wordpress and activate it.
- go to appearance -> Theme Options to view the theme settings developed for this demo.
- the preview of the demo is a bulk of array to make you understand how to retrive settings values from the settings api.
- Adding the Administration Menu
- Creating a Settings Section and Field
- Displaying the Fields
- Sanitizing Data
- Creating Section and Field Definitions
- Displaying the Fields
- Initializing Options and Creating the Admin Menu
- Registering Settings and Displaying Fields and Sections
- Creating Working Image Upload Fields
- Adding Proper Field Sanitization
the WordPress customizer is probably the easiest option for customizing the front-end. The main reason is that it’s built in; you don’t need to install additional plugins to use it. Additionally, it has a great live preview on the side that makes customizing really intuitive.
A theme options page, on the other hand, is custom, which means you need to need to hard code it in the theme files or use it as a separate plugin.