Get background color for Live Preview with Theme Customization API?

If you’re using the built in custom background stuff, it’s already all using postMessage. So, just bind a function to the background_color message and adjust your border color accordingly. Something like this, I expect: wp.customize(‘background_color’,function( value ) { value.bind(function(to) { jQuery(‘whatever’).css(‘color’, to ? to : ” ); }); }); Obviously, change the jQuery call in … Read more

Customizer Show/Hide Logo and Site Title

Try this function, why going through js when you can just do it with php inside your same file customizer.php /* ** show site title or hide it */ function showtitle_slogan() { $showttlslogan = get_theme_mod(‘display_site_title’); if ($showttlslogan == true) { ?> <style type=”text/css”> .site-title { display:none;} </style> <?php } } add_action(‘wp_head’, ‘showtitle_slogan’); And do the … Read more

Register theme customizer settings when theme activates [duplicate]

You need only use the default value on the wp_customize and that is all $wp_customize->add_setting(‘mytextoption’, array( ‘default’ => ‘defaultvalue’, ‘capability’ => ‘edit_theme_options’, ‘type’ => ‘option’, replace defaultvalue for the value you want, and when the user activate the theme this line will register the default value on the DB only when not exist on the … Read more

Customizer active callback live toggle controls

The answer was to ‘decouple’ live preview and contextual control. If I place them together, I cannot use the same action hook – live won’t work on customize_controls_enqueue_scripts and contextual control won’t work on customize_preview_init. So the answer is: add_action( ‘customize_controls_enqueue_scripts’, ‘mytheme_customizer_control_toggle’ ); add_action( ‘customize_preview_init’, ‘mytheme_customizer_live_preview’ ); /** * Live preview script enqueue * * … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)