The "dropdown-pages" control

Learn how to create controls using Kirki

Back to Controls

Returnsint

Can't find what you're looking for? Check the github issues or edit this page to add what's missing.

Exactly the same as select controls.

The only difference is that the field type is defined as dropdown-pages and it will show a list of your pages. As a result, you don’t have to manually define the choices argument as it will be auto-populated using your pages.

The default value for dropdown-pages controls can be a page ID (int).

example: 'default' => 42, The returned value is the ID of the selected page.

Example

Kirki::add_field( 'theme_config_id', [
	'type'        => 'dropdown-pages',
	'settings'    => 'my_setting',
	'label'       => esc_html__( 'This is the label', 'kirki' ),
	'section'     => 'section_id',
	'default'     => 42,
	'priority'    => 10,
] );
Edit this page