0

I'm interested in adding customizable features to a theme. What is the difference between the following

add_theme_support(...)

and

Theme Customization API

Are they just 2 different ways to accomplish the same thing? Or is add_theme_support() limited on what it can control, where the Theme Customization API is more open-ended for any type of custom functionality?

1 Answer 1

0

They're not directly really related, and do different things, except for a couple of situations.

The Customization API is a way of registering settings and controls in the Customizer, and is very flexible. You can use it to add controls for just about anything in your theme.

add_theme_support(), on the other hand, lets your theme tell WordPress (or plugins) that it supports certain features, so that WordPress can enable or change certain functionality. For example, adding support for post-thumbnails will add the featured image option to posts, while adding support for title-tag will add a <title> element to the template automatically. If you don't declare support, then WordPress will turn these off, since your theme's templates presumably don't need them.

The features you can declare support for cover a number of things, but only some of them add things to the Customizer. For example, custom-background and custom-logo add fields to the Customizer for setting a background and logo. Under the hood these are added with the Theme Customization API. So adding support for these features is effectively a way of adding a standard field/set of fields for certain features, and by using them you don't need to write as much code, and can have behaviour 100% consistent with other themes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.