/** * Helper function that holds array of theme options. * * @return array $options Array of theme options * @uses thsp_get_theme_customizer_fields() defined in customizer/helpers.php */ function thsp_cbp_get_fields() { /* * Using helper function to get default required capability */ $thsp_cbp_capability = thsp_cbp_capability(); $options = array('new_customizer_section' => array('existing_section' => false, 'args' => array('title' => __('New Section Title', 'my_theme_textdomain'), 'description' => __('New section description', 'my_theme_textdomain'), 'priority' => 1), 'fields' => array('new_text_field' => array('setting_args' => array('default' => __('Default value', 'my_theme_textdomain'), 'type' => 'option', 'capability' => $thsp_cbp_capability, 'transport' => 'refresh'), 'control_args' => array('label' => __('New text field label', 'my_theme_textdomain'), 'type' => 'text', 'priority' => 1)), 'new_checkbox_field' => array('setting_args' => array('default' => true, 'type' => 'option', 'capability' => $thsp_cbp_capability, 'transport' => 'refresh'), 'control_args' => array('label' => __('New checkbox field label', 'my_theme_textdomain'), 'type' => 'checkbox', 'priority' => 2)), 'new_radio_field' => array('setting_args' => array('default' => 'option-2', 'type' => 'option', 'capability' => $thsp_cbp_capability, 'transport' => 'refresh'), 'control_args' => array('label' => __('New radio control label', 'my_theme_textdomain'), 'type' => 'radio', 'choices' => array('option-1' => array('label' => __('Option 1', 'my_theme_textdomain')), 'option-2' => array('label' => __('Option 2', 'my_theme_textdomain')), 'option-3' => array('label' => __('Option 3', 'my_theme_textdomain'))), 'priority' => 3)), 'new_select_field' => array('setting_args' => array('default' => 'option-3', 'type' => 'option', 'capability' => $thsp_cbp_capability, 'transport' => 'refresh'), 'control_args' => array('label' => __('New select field label', 'my_theme_textdomain'), 'type' => 'select', 'choices' => array('option-1' => array('label' => __('Option 1', 'my_theme_textdomain')), 'option-2' => array('label' => __('Option 2', 'my_theme_textdomain')), 'option-3' => array('label' => __('Option 3', 'my_theme_textdomain'))), 'priority' => 4)), 'new_file_upload_field' => array('setting_args' => array('default' => '', 'type' => 'option', 'capability' => $thsp_cbp_capability, 'transport' => 'refresh'), 'control_args' => array('label' => __('File upload', 'my_theme_textdomain'), 'type' => 'upload', 'priority' => 5)), 'new_image_upload_field' => array('setting_args' => array('default' => '', 'type' => 'option', 'capability' => $thsp_cbp_capability, 'transport' => 'refresh'), 'control_args' => array('label' => __('Image upload', 'my_theme_textdomain'), 'type' => 'image', 'priority' => 6)), 'new_textarea_field' => array('setting_args' => array('default' => '', 'type' => 'option', 'capability' => $thsp_cbp_capability, 'transport' => 'refresh'), 'control_args' => array('label' => __('Textarea', 'my_theme_textdomain'), 'type' => 'textarea', 'priority' => 7)), 'new_number_field' => array('setting_args' => array('default' => '', 'type' => 'option', 'capability' => $thsp_cbp_capability, 'transport' => 'refresh'), 'control_args' => array('label' => __('Number', 'my_theme_textdomain'), 'type' => 'number', 'priority' => 8)), 'new_images_radio_field' => array('setting_args' => array('default' => 'option_1', 'type' => 'option', 'capability' => $thsp_cbp_capability, 'transport' => 'refresh'), 'control_args' => array('label' => __('Layout type', 'my_theme_textdomain'), 'type' => 'images_radio', 'choices' => array('option_1' => array('label' => __('Option 1', 'my_theme_textdomain'), 'image_src' => get_template_directory_uri() . '/images/theme-options/option-1.png'), 'option_2' => array('label' => __('Option 2', 'my_theme_textdomain'), 'image_src' => get_template_directory_uri() . '/images/theme-options/option-2.png')), 'priority' => 9)))), 'colors' => array('existing_section' => true, 'fields' => array('new_checkbox_field_colors' => array('setting_args' => array('default' => true, 'type' => 'option', 'capability' => $thsp_cbp_capability, 'transport' => 'refresh'), 'control_args' => array('label' => __('New color field label', 'my_theme_textdomain'), 'type' => 'checkbox', 'priority' => 1))))); /* * 'thsp_cbp_options_array' filter hook will allow you to * add/remove some of these options from a child theme */ return apply_filters('thsp_cbp_options_array', $options); }
function thsp_cbp_customizer_menu() { add_theme_page(thsp_cbp_menu_link_text(), thsp_cbp_menu_link_text(), thsp_cbp_capability(), 'customize.php'); }