Customizer Question: Would this workaround be considered bad practice?


I’d like my customizer controls to have a specific layout that the default technique for displaying them does not support. I’ve found that instead of using $this->link(): and $this->value() as shown here:

<textarea rows="5" style="width:100%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>

… I can instead manually assign the data-customize-setting-link attribute and the value like this:

<textarea rows="5" style="width:100%;" data-customize-setting-link="test_textarea"><?php echo esc_textarea( get_theme_mod( 'test_textarea' ) ); ?></textarea>

… which allows me increased flexibility in creating a customizer control layout that’s a bit more intuitive.

Is doing it this way OK or would it be considered bad practice? Thank you for any input you can offer!

(Leland Fiegel) #2

I don’t work with Customizer much so I probably wouldn’t be of much help. But I’m totally confused as to what you’re trying to accomplish.

Maybe it would help if you would provide screenshots of the “specific layout” versus the “default technique for displaying them” to illustrate what you’re trying to do.

And what exactly is the “font_selection” control for? I’m trying to understand why any kind of textarea is the more intuitive choice.


I updated the code so it makes more sense, ‘font_selection’ was just a random name I threw in there to test it out on my install. Hope your week is going well!