• Manteli

    (@manteli)


    Hello

    After I added theme-customizer.js to the functions.php I started to get black HTTP ERROR 500 on every page on my blog.

    theme-customizer.js looks like this:

    /**
     * This file adds some LIVE to the Theme Customizer live preview. To leverage
     * this, set your custom settings to 'postMessage' and then add your handling
     * here. Your javascript should grab settings from customizer controls, and
     * then make any necessary changes to the page using jQuery.
     */
    ( function( $ ) {
    
    	// Update the site title in real time...
    	wp.customize( 'blogname', function( value ) {
    		value.bind( function( newval ) {
    			$( '#site-title a' ).html( newval );
    		} );
    	} );
    
    	//Update the site description in real time...
    	wp.customize( 'blogdescription', function( value ) {
    		value.bind( function( newval ) {
    			$( '.site-description' ).html( newval );
    		} );
    	} );
    
    	//Update site link color in real time...
    	wp.customize( 'h1_header_color', function( value ) {
    		value.bind( function( newval ) {
    			$('h1 a').css('color', newval );
    		} );
    	} );
    
    } )( jQuery );

    Adding theme-customizer.js to functions.php

    /**
         * Used by hook: 'customize_preview_init'
         *
         * @see add_action('customize_preview_init',$func)
         */
        public static function hello_customizer_live_preview()
        {
            wp_enqueue_script(
                  'hello-themecustomizer',			//Give the script an ID
                  get_template_directory_uri().'/js/theme-customizer.js',//Point to file
                  array( 'jquery','customize-preview' ),	//Define dependencies
                  '',						//Define a version (optional)
                  true						//Put script in footer?
            );
        }
        add_action( 'customize_preview_init', 'hello_customizer_live_preview' );

    When I remove the code above, the error disappears. What am I doing wrong?

The topic ‘HTTP ERROR 500 After adding theme-customizer.js to functions.php’ is closed to new replies.