Skip to content

Commit 5b228e8

Browse files
committed
Adds a pages field type to display list of pages
1 parent d39a9ad commit 5b228e8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/class.settings-api.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,24 @@ function callback_color( $args ) {
406406
echo $html;
407407
}
408408

409+
410+
/**
411+
* Displays a select box for creating the pages select box
412+
*
413+
* @param array $args settings field args
414+
*/
415+
function callback_pages( $args ) {
416+
417+
$dropdown_args = array(
418+
'selected' => esc_attr($this->get_option($args['id'], $args['section'], $args['std'] ) ),
419+
'name' => $args['section'] . '[' . $args['id'] . ']',
420+
'id' => $args['section'] . '[' . $args['id'] . ']',
421+
'echo' => 0
422+
);
423+
$html = wp_dropdown_pages( $dropdown_args );
424+
echo $html;
425+
}
426+
409427
/**
410428
* Sanitize callback for Settings API
411429
*

0 commit comments

Comments
 (0)