# [SOLVED] Admin theme customizer

**URL:** https://discourse.roots.io/t/solved-admin-theme-customizer/6107
**Category:** sage
**Created:** 2016-03-03T23:05:27Z
**Posts:** 4
**Showing post:** 3 of 4

## Post 3 by @paul_tibbetts — 2016-07-03T00:20:20Z

In the same vein, this is how I added an option for a logo and a maximum width for it:

```
// lib/customizer.php
$wp_customize->add_setting('upload_logo');

  $wp_customize->add_control(
    new \WP_Customize_Image_Control(
      $wp_customize,
      'upload_logo',
      array(
        'label' => 'Logo',
        'section' => 'title_tagline',
        'settings' => 'upload_logo',
        'transport' => 'postMessage'
      )
    )
  );

  $wp_customize->add_setting(
    'upload_logo_width',
    array(
      'default' => '',
      'sanitize_callback' => 'sanitize_text_field'
    )
  );

  $wp_customize->add_control(
    'upload_logo_width',
    array(
      'label' => 'Logo Max Width',
      'section' => 'title_tagline',
      'settings' => 'upload_logo_width',
      'transport' => 'postMessage'
    )
  );
```

which appears in the `Site identity` panel:

 ![](https://discourse.roots.io/uploads/default/original/2X/5/5973e10b79796b106e163b445c0c8cd4f87fbf38.png)

I’ve uploaded a [gist](https://gist.github.com/ptibbetts/074c0754d2450285f3c816f549536760) with the full code I used, including the JavaScript for live-updating the preview and some code that prints these options as `<style>` tags into the `head`.

Please note that it’s a very basic way of doing things (it was the first time I’d used the customizer) and is just meant to serve as a simple example for piecing all the bits together.

It should probably:

a) be refactored  
b) not be shared, but I’ve had a few beers now and I’m enjoying feeling like I’m being helpful :watermelon:

---

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