Theme Customization API now showing
-
Hey there,
I’m working on a new Worpdress-Theme and I’m currently stuck with the Theme Customization API. I’m not really new to WordPress/Coding but never had anything to do with the API. So I watched some totorials and readed some posts about that whole thing and started including it into my Theme. Sofar everything went well. But now for some reason, my new sections I wrote into my functions.php are not showing up in the Theme Customasation API. I allredy tryed to remove some parts but nothing has changed. Is there anything wrong with my code? Or is it something different?
Here’s my functions.php code:
function tonya_customizer_register($wp_customize) { $wp_customize->add_section('tonya_colors', array( 'title' => __('Colors', 'tonya'), 'description' => 'Modify the theme colors' )); // Background Color $wp_customize->add_setting('background_color', array( 'default' => '#fff', )); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'background_color', array( 'label' => __('Edit Background Color','tonya'), 'section' => 'tonya_colors', 'settings' => 'background_color', ) )); // Plain Text $wp_customize->add_setting('plain_text', array( 'default' => 'test', )); $wp_customize->add_control( new WP_Customize_Control($wp_customize, 'plain_text', array( 'label' => __('Edit Plain Text','tonya'), 'section' => 'tonya_colors', 'settings' => 'plain_text', ) )); // Upload Image $wp_customize->add_setting('upload_image', array( 'default' => 'test', )); $wp_customize->add_control( new WP_Customize_Upload_Control($wp_customize, 'upload_image', array( 'label' => __('Edit Uplaod Image','tonya'), 'section' => 'tonya_colors', 'settings' => 'upload_image', ) )); // Checkbox $wp_customize->add_section('tonya_checkbox', array( 'title' => __('Layout Options', 'tonya'), 'description' => 'Modify the layout' )); $wp_customize->add_setting('checkbox_setting', array( 'default' => 'left', )); $wp_customize->add_control( 'checkbox_select', array( 'label' => __('Checkbox One','tonya'), 'section' => 'tonya_checkbox', 'settings' => 'checkbox_setting', 'type' => 'checkbox', 'choices' => array( 'left' => 'Right Checkbox', 'right' => 'Left Checkbox', ) )); } function tonya_css_customizer() { ?> <style type="text/css"> body { background-color: #<?php echo get_theme_mod('background_color'); ?>; } </style> <?php } ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Theme Customization API now showing’ is closed to new replies.