We build easy to manage, secure and Mobile friendly Websites.

How to Customize H1 Text Color Using WordPress Customizer


$wp_customize->add_setting('themeslug_color_id', array(
      'default'        => '#39C',
      'transport'   => 'refresh',
      'sanitize_callback' => 'sanitize_hex_color',
  ));
  $wp_customize->add_control( 
      new WP_Customize_Color_Control( 
      $wp_customize, 
      'themeslug_color_id', 
      array(
          'label'      => esc_html__('Text Color', 'themeslug'),
          'section'    => 'themeslug_section_id',
              'setting'   => 'themeslug_color_id',
  
      ) ) );

Usage

<h1 style="color:<?php esc_html_e( get_theme_mod( 'themeslug_color_id' ))?>"> Hello World </h1>

Leave a Reply

Your email address will not be published.