Dropdown Page

The dropdown-page lets you add a select field with list of pages.

Dropdown Page

Parameters

Here are the parameters in adding dropdown-page.

id
string | required

a unique slug-like string to use as an id and also as index in saving data in database.

label
string | optional

the label of the field.

description
string | optional

the description of the field and display under the label.

section
string | requiredl

the section where the field will be displayed.

default
integer | optional

the default value of the field.

Note: default value must be a page id.

priority
integer | optional

determines the order of fields in section.

order
string | optional

sets the order to ascending and descending.

Note: order only accept 'asc' and 'desc'.

Example


Yano::field( 'dropdown-page', [
   'id'          => 'dropdownpagedb1',	
   'label'       => 'Select Page',
   'description' => 'You can select a page in here.',
   'section'     => 'section_id',
   'priority'    => 1,
   'order'       => 'asc'
] );

Example with default value! note: default value must existing page id.


Yano::field( 'dropdown-page', [
   'id'          => 'dropdownpagedb1',	
   'label'       => 'Select Page',
   'description' => 'You can select a page in here.',
   'section'     => 'section_id',
   'default'     => 100,
   'priority'    => 1,
   'order'       => 'desc'
] );

Usage

The get_theme_mod() function is recommended to retrieve data.


// Get the page by id
$page = get_post( get_theme_mod('dropdownpagedb1') );