$wp_customize->add_setting( 'background_color', array(
'default' => '#fff',
'transport' => 'postMessage',
) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'background_color', array(
'label' => esc_html__('Background Color', 'sky'),
'section' => 'sky_general_settings_styling',
'settings' => 'background_color',
'priority' => 10,
) ) );
$this->add_section(
'background_image',
array(
'title' => __( 'Background Image' ),
'theme_supports' => 'custom-background',
'priority' => 80,
)
);
$this->add_setting(
'background_image',
array(
'default' => get_theme_support( 'custom-background', 'default-image' ),
'theme_supports' => 'custom-background',
'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
)
);
$this->add_setting(
new WP_Customize_Background_Image_Setting(
$this,
'background_image_thumb',
array(
'theme_supports' => 'custom-background',
'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
)
)
);
$this->add_control( new WP_Customize_Background_Image_Control( $this ) );
add_action( 'wp_enqueue_scripts', 'action_function_name_7714', 99 ); function action_function_name_7714(){ wp_localize_script( 'jquery', 'themeoptions', array( 'sky_header_sticky' => get_theme_mod( 'sky_header_sticky' ), ) ); }
var inner = $( '#site-header' ); if (true == themeoptions.sky_header_sticky) { $(window).scroll(function () { if ($(this).scrollTop() > 200) { inner.addClass("fixed"); } else { inner.removeClass("fixed"); } }); }
function wpdocs_theme_name_scripts() { if( get_theme_mod( 'sky_header_sticky' ) ) { wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); } } add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );