• Hello,

    im making a custom theme which has an custom settings page. on this page there is an upload logo button. i have the .js file and so on but if i clicked on the upload button nothing happens.

    thinks i had done allready:

    – i created the function in functions.php to save the setting
    – i enqueued the js and the media in enqueue.php

    my extra js which isn`t working is the <em>options.js</em>

    here is my js code:

    wp_register_script( 'dd_bootstrap', get_template_directory_uri() . '/vendor/bootstrap/js/bootstrap.min.js', array(), false, true );
        wp_register_script( 'dd_scrollreveal', get_template_directory_uri() . '/vendor/scrollreveal/scrollreveal.min.js', array(), false, true );
        wp_register_script( 'dd_options', get_template_directory_uri() . '/js/options.js', array(), false, true );
    
        wp_enqueue_script('jquery');
        wp_enqueue_script( 'dd_bootstrap' );
        wp_enqueue_script( 'dd_scrollreveal' );
        wp_enqueue_script( 'dd_options' );
    
        wp_enqueue_media();

    the area of my enqueue.php code:

    wp_register_script( 'dd_bootstrap', get_template_directory_uri() . '/vendor/bootstrap/js/bootstrap.min.js', array(), false, true );
        wp_register_script( 'dd_scrollreveal', get_template_directory_uri() . '/vendor/scrollreveal/scrollreveal.min.js', array(), false, true );
        wp_register_script( 'dd_options', get_template_directory_uri() . '/js/options.js', array(), false, true );
    
        wp_enqueue_script('jquery');
        wp_enqueue_script( 'dd_bootstrap' );
        wp_enqueue_script( 'dd_scrollreveal' );
        wp_enqueue_script( 'dd_options' );
    
        wp_enqueue_media();

    thanks for any help and regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter glotza

    (@glotza)

    Sorry wrong js code my js code is:

    jQuery(function($){
    	var frame                = wp.media({
             title:                 'Select or upload Logo',
            button:                {
              text:                 'Use this Media'
           },
            multiple:                false
    	});
    
    	$("#dd_uploadLogoImgBtn").click(function(e) {
             e.preventDefault();
    
             frame.open();
    		});
    
    	    frame.on('select', function(){
    	      var attachment     = frame.state().get('selection').first().toJSON();
    	      $("input[name=dd_inputLogoImg]").val(attachment.url);
    
    	    });
    });

    There’s no way for anyone here to run that code. Use the developer tools in Firefox (or Firebug) or Chrome or Safari or IE to check for Javascript and other console errors.

    Thread Starter glotza

    (@glotza)

    i have no errors in my control panel on firebug

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Jquery Problem on Custom Setting Page’ is closed to new replies.