Jquery Ui Tabs with Wordpress -


jquery ui tabs not working in wordpress, have added function functions.php

if( !is_admin()){    wp_deregister_script('jquery');    wp_register_script('jquery', ("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"));    wp_enqueue_script('jquery');    wp_deregister_script('jquery-ui');    wp_register_script('jquery-ui',("https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"));    wp_enqueue_script('jquery-ui'); } 

and header.php

<ul class="menu-nav">     <?php wp_nav_menu(array('theme_location' => 'menu')); ?> 

you have few things going here. default wordpress splits jquery ui component parts , registers each part separately. jquery handle registered in wordpress registers 2 scripts: jquery-core , jquery-migrate. if want deregister jquery, use jquery-core handle.

if want unload wordpress jquery ui delivered code, first need wp_deregister_script('jquery-ui-core') there no jquery-ui handle registered in wordpress.

you don't need parens around source urls in either of wp_register_script lines: wp_register_script('jquery', "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js");

you should include dependency parameter when registering jquery-ui script, this:

wp_register_script('jquery-ui','https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js', array( 'jquery' ) );

all of jquery ui handles pre registered in wordpress below:

jquery-ui-core, jquery-effects-core, jquery-effects-blind, jquery-effects-bounce, jquery-effects-clip, jquery-effects-drop, jquery-effects-explode, jquery-effects-fade, jquery-effects-fold, jquery-effects-highlight, jquery-effects-pulsate, jquery-effects-scale, jquery-effects-shake, jquery-effects-slide, jquery-effects-transfer, jquery-ui-accordion, jquery-ui-autocomplete, jquery-ui-button, jquery-ui-datepicker, jquery-ui-dialog, jquery-ui-draggable, jquery-ui-droppable, jquery-ui-menu, jquery-ui-mouse, jquery-ui-position, jquery-ui-progressbar, jquery-ui-resizable, jquery-ui-selectable, jquery-ui-slider, jquery-ui-sortable, jquery-ui-spinner, jquery-ui-tabs, jquery-ui-tooltip, jquery-ui-widget


Comments