Support » Fixing WordPress » JQuery UI Not Loading

  • I have installed a wordpress theme at this location: naturalhealthdirectory.co.uk/natural_health_directory

    I’m trying to install a premium plugin from themeforest that books room reservations. This is determined by a shortcode at this location: http://naturalhealthdirectory.co.uk/natural_health_directory/reserve-a-room/

    The calendar that is supposed to appear on this page does not display. I contact the plugin owner and he referred me to the wordpress codex stating that the jquery on the site wasn’t loading. How should I go about resolving this, thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Add this to your functions.php file in your active theme. Use the wp_enqueue_script function, the “WordPress” way of loading javascript. I’m assuming you actually need datepicker and jquery UI too.

    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    wp_enqueue_script( 'jquery' );
    wp_enqueue_script( 'jquery-ui-core' );
    wp_enqueue_script( 'jquery-ui-datepicker' );

    Technically you could just load datepicker and it would load its needed dependencies, but for completeness’s sake I included the first two.

    Thanks for the reply! I added that to my functions.php file, but there was no different result. Here’s what I’ve got going in my theme:

    function clava_enqueue_script() {
    	wp_enqueue_script( "jquery" );
    	wp_enqueue_script( 'jquery-ui-core' );
    	wp_enqueue_script( 'jquery-ui-datepicker' );
    	wp_enqueue_script( "bootstrap", get_template_directory_uri(). "/js/vendor/bootstrap.min.js", "jquery", false, true);
    	wp_enqueue_script( "bootstrapjs", get_template_directory_uri(). "/js/vendor/bootstrap.js", "jquery", false, true);
    	wp_enqueue_script( "easing", get_template_directory_uri(). "/js/jquery.easing.1.3.js", "jquery", false, true);
    	wp_enqueue_script( "retina", get_template_directory_uri(). "/js/retina-1.1.0.min.js", "jquery", false, true);
    	wp_enqueue_script( "cookie", get_template_directory_uri(). "/js/jquery.cookie.js", "jquery", false, true);
    	wp_enqueue_script( "styleswitch", get_template_directory_uri(). "/js/styleswitch.js", "jquery", false, true);
    	wp_enqueue_script( "superfish", get_template_directory_uri(). "/js/jquery.superfish.js", "jquery", false, true);
    	wp_enqueue_script( "modernizr", get_template_directory_uri(). "/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js", "jquery", false, true);
    	wp_enqueue_script( "jpanelmenu", get_template_directory_uri(). "/js/jquery.jpanelmenu.js", "jquery", false, true);
    	wp_enqueue_script( "blackandwhite", get_template_directory_uri(). "/js/jquery.blackandwhite.min.js", "jquery", false, true);
    	wp_enqueue_script( "rev", get_template_directory_uri(). "/js/jquery.themepunch.revolution.min.js", "jquery", false, true);
    	wp_enqueue_script( "jcarousel", get_template_directory_uri(). "/js/jquery.jcarousel.js", "jquery", false, true);
    	wp_enqueue_script( "jflickrfeed", get_template_directory_uri(). "/js/jflickrfeed.js", "jquery", false, true);
    	wp_enqueue_script( "jflickrfeedsetup", get_template_directory_uri(). "/js/jflickrfeed-setup.js", "jquery", false, true);
    	wp_enqueue_script( "magnific", get_template_directory_uri(). "/js/jquery.magnific-popup.min.js", "jquery", false, true);
    	wp_enqueue_script( "isotope", get_template_directory_uri(). "/js/jquery.isotope.min.js", "jquery", false, true);
    	wp_enqueue_script( "swipe", get_template_directory_uri(). "/js/swipe.js", "jquery", false, true);
    	wp_enqueue_script( "tweetable", get_template_directory_uri(). "/js/tweetable.jquery.js", "jquery", false, true);
    	wp_enqueue_script( "timeago", get_template_directory_uri(). "/js/jquery.timeago.js", "jquery", false, true);
    	wp_enqueue_script( "gmap", get_template_directory_uri(). "/js/jquery.gmap.js", "jquery", false, true);
    	wp_enqueue_script( "main", get_template_directory_uri(). "/js/main.js", "jquery", false, true);
    	$purl = array( 'template_url' => get_template_directory_uri() );
            wp_localize_script( 'main', 'purl', $purl );
    }
    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Does it happen when you change: "jquery" to array( 'jquery' ).

    I changed it to: wp_enqueue_script array( ‘jquery’ );

    that broke the site unfortunately. Is that the correct way to implement it?

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    I meant for the others. Like

    // instead of just "jquery"
    wp_enqueue_script( "bootstrap", get_template_directory_uri(). "/js/vendor/bootstrap.min.js", "jquery", false, true);
    // Use array( 'jquery' )
    wp_enqueue_script( "bootstrap", get_template_directory_uri(). "/js/vendor/bootstrap.min.js", array( "jquery" ), false, true);

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘JQuery UI Not Loading’ is closed to new replies.