Here’s another control from O2 – WordPress Customizer library. It’s a radio buttonset control, built using WordPress’ admin UI.
You can find it in O2 library here. It’s a part of the library so you will have to download the entire library. Feel free to delete other controls if you’re not using them.
Place /o2/ folder in your theme, and include it by adding the following code:
define( 'O2_DIRECTORY', get_template_directory() . '/inc/o2/' ); define( 'O2_DIRECTORY_URI', get_template_directory_uri() . '/inc/o2/' ); require get_template_directory() . '/inc/o2/controls/radio-buttonset/radio-buttonset-control.php';
First you need to define directory and directory URI of the /o2/ folder after that you need to include radio-buttonset-control.php file.
And that’s all you need to do.
You can add it to your customizer like this:
$wp_customize->add_setting( 'o2_radio_buttons', array( 'default' => 'left' 'capability' => 'edit_theme_options' )); $wp_customize->add_control(new O2_Customizer_Radio_Buttonset_Control($wp_customize, 'o2_radio_buttons', array( 'label' => __('Image Alignment', 'textdomain'), 'description' => __('Choose the alignment for your blog images.', 'textdomain'), 'section' => 'your_section', 'priority' => 5, 'settings' => 'o2_radio_buttons', 'choices' => array( 'left' => __('Left', 'textdomain'), 'center' => __('Center', 'textdomain'), 'right' => __('Right', 'textdomain'), 'none' => __('none', 'textdomain'), ) )));
That will do the work. It can be used as a layout selector. It was built a couple of months ago but I never got time to share it. I’ll try to add more controls to the O2 library and share them here as soon as they are done, so let’s hope it works out.
Feel free to leave a comment if you have any questions or suggestions.