• HI everyone,

    I’m having a really hard time getting ‘wp_enqueue_script’ to load correctly and work in the admin.

    Here is my code:

    function load_scripts(){
    	wp_enqueue_script( 'jquery' );
    	wp_enqueue_script( 'jquery-ui-core' );
    	wp_enqueue_script( 'jquery-ui-tabs' );
    
    	echo '<script type="text/javascript">
    		jQuery.noConflict();
    		jQuery(document).ready(function($) {
    				jQuery("#tabs").tabs();
    		});
    	</script>';
    
    	echo '
    	<style type="text/css">
    	.ui-tabs .ui-tabs-hide {
    	     display: none;
    	}
    	</style>
    	';
    }
    
    add_action( 'admin_head', 'load_scripts' );

    its not loading in the scripts and it’s returning an: “jQuery(“#tabs”).tabs is not a function” error in FireBug.

    Please help..

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey did you figure this out? If so how’d you do it?

    hey, I figured this one out..
    when you are using the “add_action” to load the scripts make sure you use the ‘wp_print_scripts’ hook. Hope this helps.

    hey guys. having this problem myself, very frustrating.

    jquery-ui simply won’t load using the wp_enqueue_script function.

    the only way i can get this to function (albeit, without jqueryui css) is this;

    function load_custom_scripts() {
    	wp_register_script('my-jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.js');
    	wp_enqueue_script( 'my-jquery-ui' );
    }
    
    add_action('admin_init', 'load_custom_scripts');

    this should work but doesn’t.

    wp_enqueue_script( 'jquery-ui-core' );

    I’ve tried @designerfoo’sn suggestion above but that doesn’t work.

    any ideas?

    Hello,
    having the same Problem yesterday when I try to load the Scripts in a Theme Header.
    Loading the Scripts by this way for Admin Functions works fine.

    Now I have a Solution for the Frontend:

    wp_enqueue_script('theme_js', get_template_directory_uri().'/js/theme.js', array('jquery', 'jquery-ui-tabs'));

    The third parameter ($deps) is crucial.
    After this call the Scripts jquery.js, ui.core.js and ui.tags.js were loaded in the Theme Header. (Tested in WP 3.0)

    From Doku:

    $deps (array) (optional) Array of handles of any script that this script depends on; scripts that must be loaded before this script. false if there are no dependencies. This parameter is only required when WordPress does not already know about this script.

    Hope it will help you to.
    Sabine

    P.S.: Sorry for my bad english 😉

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘wp_enqueue_script with Jquery UI and Tabs’ is closed to new replies.