I'm trying to create an option within the customizer that is basically a list of pages with checkboxes. I have that part working but I don't understand how to save it AND how to retrieve the saved data.
This is what I have so far...
class Customize_Pages_Control extends WP_Customize_Control {
public $type = 'pages';
public function render_content() {
$pages = get_pages(); ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php
foreach ($pages as $page) { // Loop through pages and add checkboxes
?>
<label>
<input type="checkbox" value="<?php echo $page->ID ?>">
<?php echo $page->post_title; ?>
</label> <?php
}
}
}
$wp_customize->add_setting('list_pages' , array(
'capability' => 'edit_theme_options',
));
$wp_customize->add_control(new Customize_Pages_Control($wp_customize, 'list_pages', array(
'label' => __( 'Add pages to slideshow' ),
'section' => 'options_ga_code',
'settings' => 'list_pages',
'type' => 'pages',
)));