Reply To: ajaxsearch.pro.js collision with inclusion of jquery.ui

Home Forums Product Support Forums Ajax Search Pro for WordPress Support ajaxsearch.pro.js collision with inclusion of jquery.ui Reply To: ajaxsearch.pro.js collision with inclusion of jquery.ui

#3815
eggmatters
eggmatters
Participant

Thanks for your response and my apologies for the boffed email. I did comment out line 85, and no luck. The behavior I’m describing is a page rendered by my plugin. At it’s core, it is an assembly of shorttags which render formatted html snippets of data made by api calls. Some of these render forms as modal dialogs via qquery-ui. With ajax-search-pro enabled, the dialogs fail to load. Firebug shows the following:


TypeError: $(...).dialog is not a function

I’m seeing the inclusion of jquery-ui in my script loads, but I believe it is a namespace collision with the inclusion of ‘ajax-searchpro.js’.
The page dependent on rendering this data does not include the search bar shortcode, but wp will load the plugin anyway.
My plugin makes several api calls. To ensure that these calls or only made when needed, I wrote a filter will only make api calls etc, if a specific shortcode is included.
I load a local copy of jquery-ui, not the cdn or the built in wp instance. I therefore disable these. I have my own javascript inclusion set to load preferably last:


add_action('wp_enqueue_scripts', array(&$this, 'addScriptTags'), 999);

And then I deregister jquery & jquery-ui and register my own:


function addScriptTags() {
    $today = date('Ymd', time());
    wp_deregister_script( 'jquery' );
    wp_deregister_script('jquery-ui-core' );
    wp_deregister_script('spin');
    //wp_deregister_script('wpdreams-ajaxsearchpro');
    wp_deregister_style('jquery-ui');
    wp_register_script('jquery', plugins_url('views/js/jquery.js', __FILE__), array(), null);
    wp_register_script('jquery-ui-core', plugins_url('views/js/jquery-ui.min.js', __FILE__), array('jquery'), $today, null );

When wp_deregister_script('wpdreams-ajaxsearchpro'); is uncommented, I get the following errors:


Notice: Undefined index: wpdreams-ajaxsearchpro in /var/www/html/wp-includes/class.wp-scripts.php on line 200
Notice: Trying to get property of non-object in /var/www/html/wp-includes/class.wp-scripts.php on line 200

Which is odd because, I specified a pretty higher priority number to my enqueue scripts than you did (me: 999, you: 10). The deregister should definitely be called after your scripts have been registered.

  • This reply was modified 9 years, 1 month ago by eggmatters eggmatters.
  • This reply was modified 9 years, 1 month ago by eggmatters eggmatters. Reason: add function name for clarity