Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@westonruter
Last active February 16, 2017 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save westonruter/a5ce4e3848bc0a22f24587ec41081709 to your computer and use it in GitHub Desktop.
Save westonruter/a5ce4e3848bc0a22f24587ec41081709 to your computer and use it in GitHub Desktop.
<?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