Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I make custom sections of the Wordpress Theme Customizer show changes?
    text
    copied!<p>I'm creating a theme and I've started doing some work on the theme customizer. I'm going to do all of it in the theme functions, but I have an issue I want to figure out first:</p> <p>I've added a Typography section which currently only has some color pickers that can change the color of paragraph text and links. However, it doesn't work. There's no errors, section displays with the options, but nothing changes when I change the colors. Here's my code, if anyone can help me out, I'd be thrilled :)</p> <pre><code>/* Theme Customizer Code */ function dsgn_customizer_register($wp_customize) { $wp_customize-&gt;add_section('dsgn_typograhy', array( 'title' =&gt; __('Typography', 'dsgn'), 'description' =&gt; ('Modify the theme typography') )); $wp_customize-&gt;add_setting('content_color', array( 'default' =&gt; '#544e4e', )); $wp_customize-&gt;add_setting('link_color', array( 'default' =&gt; '#BF5050', )); $wp_customize-&gt;add_control( new WP_customize_color_control($wp_customize, 'content_color', array( 'label' =&gt; __('Edit Content Text Color', 'dsgn'), 'section' =&gt; 'dsgn_typograhy', 'settings' =&gt; 'content_color' ) )); $wp_customize-&gt;add_control( new WP_customize_color_control($wp_customize, 'link_color', array( 'label' =&gt; __('Edit Link Text Color', 'dsgn'), 'section' =&gt; 'dsgn_typograhy', 'settings' =&gt; 'link_color' ) )); } function dsgn_css_customizer() { ?&gt; &lt;style type="text/css"&gt; a { color: &lt;?php echo get_theme_mod('link_color'); ?&gt;; } .entry-content p { color: &lt;?php echo get_theme_mod('content_color'); ?&gt;; } &lt;/style&gt; &lt;?php } add_action('wp-head', 'dsgn_css_customizer'); add_action('customize_register', 'dsgn_customizer_register'); </code></pre> <p><strong>NOTE:</strong> I tried adding another control for the body background-color and that works perfectly... I did actually already have support for background-color using this code:</p> <pre><code>// Add theme support for Custom Background $background_args = array( 'default-color' =&gt; 'e9e9e9', 'default-image' =&gt; '', 'wp-head-callback' =&gt; '_custom_background_cb', 'admin-head-callback' =&gt; '', 'admin-preview-callback' =&gt; '', ); add_theme_support( 'custom-background', $background_args ); </code></pre> <p>When I remove that code, the option no longer works, so I'm guessing I maybe have to add some kind of support for the typography changes as well..?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload