Admin theme customizer


At the moment I’m trying to work with wordpress built in Customizer, For som reason i cant get the live preview to work, don’t know if it is because i have made something wrong… But simply written this code:

function tcx_register_theme_customizer( $wp_customize ) {

‘default’ => ‘#000000’,
‘transport’ => ‘postMessage’

new WP_Customize_Color_Control(
‘label’ => __( ‘Link Color’, ‘tcx’ ),
‘section’ => ‘colors’,
‘settings’ => ‘tcx_link_color’
add_action( ‘customize_register’, ‘tcx_register_theme_customizer’ );

function tcx_customizer_css() {

a { color: <?php echo get_theme_mod( 'tcx_link_color' ); ?>; } <?php } add_action( 'wp_head', 'tcx_customizer_css' );

function tcx_customizer_live_preview() {

get_template_directory_uri() . ‘assets/js/theme-customizer.js’,
array( ‘jquery’, ‘customize-preview’ ),

} // end tcx_customizer_live_preview
add_action( ‘customize_preview_init’, ‘tcx_customizer_live_preview’ );

With the fallowing JS file:

(function( $ ) {
“use strict”;

wp.customize( ‘tcx_link_color’, function( value ) {
value.bind( function( to ) {
$( ‘head a’ ).css( ‘color’, to );
} );

})( jQuery );

And for some reason it works perfectly to save here, but the live preview doesn’t work…

If some one is able to guide me how to use The customizer in wordpress together with ROOTS that would be amazing!


Using Roots has no effect on the WordPress Theme Customizaton API; it should function normally. If you experience a bug with the API and suspect it is related to Roots then a standard debugging procedure is to activate a default WordPress theme to determine whether it is in fact related to Roots, and debug from there.

There are innumerable tutorials on the theme customizer out there, but this site is for Roots theme discussions. I suggest you consult those tutorials along with the WordPress documentation and, if all else fails, ask your question on or another similar site.