# Admin theme customizer

**URL:** https://discourse.roots.io/t/admin-theme-customizer/2359
**Category:** uncategorized
**Created:** 2014-10-08T18:06:55Z
**Posts:** 2
**Showing post:** 1 of 2

## Post 1 by @max_grundell — 2014-10-08T18:06:55Z

Hello,

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 ) {

> $wp\_customize-\>add\_setting(  
> ‘tcx\_link\_color’,  
> array(  
> ‘default’ =\> ‘#000000’,  
> ‘transport’ =\> ‘postMessage’  
> )  
> );

> $wp\_customize-\>add\_control(  
> new WP\_Customize\_Color\_Control(  
> $wp\_customize,  
> ‘link\_color’,  
> array(  
> ‘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() {

> wp\_enqueue\_script(  
> ‘tcx-theme-customizer’,  
> get\_template\_directory\_uri() . ‘assets/js/theme-customizer.js’,  
> array( ‘jquery’, ‘customize-preview’ ),  
> ‘0.3.0’,  
> true  
> );

> } // 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!

Best,  
Max

---

_[View the full topic](https://discourse.roots.io/t/admin-theme-customizer/2359)._
