layers_customizer_sections

Last Updated:
Back to Main Index

This filter allows modification of the sections() array, which outputs the Customizer Sections for Layers, such as Site Settings, Header, Footer etc.

Location

/core/customizer/config.php

Usage


In most cases, the core panels should not be removed from a child theme or extension, but you may want to filter them to add additional sections, or add conditions on custom sites, such as hiding all but the Colors for users with a certain role or capability.

Adding a Custom Section

Each section should define a title  and the panel  it will be added to. This example shows how you would add a custom section called Social Media Profiles to a custom panel called theme-options  (Theme Options)

Adding Sections to Existing Panels

This example shows how you would add a custom section called Social Media Profiles to the existing Header (header) panel in Layers. The primary difference here is the array_merge which takes your section and merges it with the existing ones. You must merge on existing panels, whereas you don’t if using a custom panel.

See How to Add Customizer Sections & Controls

To add Customizer Options using the WordPress Core API, go here