How to use it
Themes define a subset of core-provided starter content using
add_theme_support() – let’s look at a breakdown of how Twenty Seventeen does things. In its setup function hooked to
after_setup_theme, we see an array with collections of widgets, posts (pages), attachments, options, theme mods, and nav menus registered as the starter content. The customizer looks for this
after_setup_theme priority 100, so do make this call at that point or later:
add_theme_support( 'starter-content', array( /*...*/ ) )
Each widget area ID corresponds to one sidebar registered by the theme, with the contents of each widget area array being a list of widget “symbols” that reference core-registered widget configurations. Most default widgets are available (
search), as well as text widgets with business hours (
text_business_info) and a short prompt for an “about this site” style blurb (
text_about). Themes should place widgets based on what works best in that area – for instance, business info in a footer widget of a business-centric theme, or a nicely styled calendar widget in the sidebar of a blog.
Custom widgets can also be registered at the time of starter content registration or later filtered in, which will be more likely the case for plugins, as
add_theme_support() for starter content will be overridden by any later calls.