Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
function my_styles_method() {
wp_enqueue_style( 'custom-style', get_template_directory_uri() . '/custom-css.css' );
$colors = array(
'headings_color' => get_theme_mod( 'wpt_heading_color' ),
);
$css_output = "{color: {$colors['headings_color']}; }";
$selector = 'h1,h2,h3,h4,h5,h6';
$css = $selector . $css_output; // @todo The $css variable is not used.
if ( is_customize_preview() ) {
wp_enqueue_script( 'wpt_customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '', true );
wp_add_inline_script( 'wpt_customizer', sprintf( 'var MyStylesSelector = %s;', wp_json_encode( $selector ) ), 'before' );
}
}
add_action( 'wp_enqueue_scripts', 'my_styles_method', 21 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment