WordPress.org

Ready to get started?Download WordPress

Forums

Add CSS to the WP Theme Customizer toolbar (1 post)

  1. phillbooth
    Member
    Posted 1 year ago #

    Hello I have added a <div> as an option to the WP Theme Customizer toolbar, I intend this to show different CSS background options using the css background-image: -webkit-gradient rendering however I have found no way to add the CSS, the add_action( 'wp_head') does not seem to allow update to the toolbar.

    The code below works and ads a <div> to the background color tab but this is as far as I have got.

    Please help.

    function mytheme_customize_register( $wp_customize ) {
    	class Example_Customize_Textarea_Control extends WP_Customize_Control {
    		public $type = 'textarea';
    
    		public function render_content() {
    			?>
    				<div id="css1">xx</div>
    
    			<?php
    		}
    	}
    
    	$wp_customize->add_setting( 'textarea' );
    
    	$wp_customize->add_control(
    		new Example_Customize_Textarea_Control(
    			$wp_customize,
    			'textarea',
    			array(
    				'label' => 'Textarea',
    				'section' => 'colors',
    				'settings' => 'textarea'
    			)
    		)
    	)
    }

Topic Closed

This topic has been closed to new replies.

About this Topic