After installing the new theme theme, through the control Panel's customize function, you can enter the custom interface, you can see a lot of options, how to add such options?
First, find the customize_register corresponding function in the inc/customizer.php of the topic and add the following:
$ wp_customize - add_setting (
' Blog_disp ',
Array(
' Sanitize_callback ' = ' Astrid_sanitize_checkbox ',
)
);
$wp_customize-add_control(
' Blog_disp ',
Array(
' type ' = ' checkbox ',
' label ' = __ ('Display post? ', ' Astrid ' ),
' Section ' = ' blog_options ',
' Priority ' = at
)
);
This code creates a new checkbox entry whose method callback function is Astrid_sanitize_checkbox:
function Astrid_sanitize_checkbox( $input ) { &NB Sp , &NB Sp , &NB Sp , &NB Sp  
if ($ input = = 1 ) {
return 1;
} Else {
return ';
}
}
Where you need to use this option, add the following code:
<?php if (get_theme_mod (' Blog_disp ' ) = = 1 ): ?>
[Parts that need to be controlled by the checkbox]
<?php endif; ?>
Add custom options for theme in WordPress