Search bar breaking site when inserted in modal window

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Search bar breaking site when inserted in modal window

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 7 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10114
    bosh
    bosh
    Participant

    Hi!

    We’re trying to integrate the ajax form in our theme’s main search. The search appears in a modal window when you click on the magnifying glass in the top-right corner.

    If the Wp-Ajax-Search is enabled and the shortcode is being called in the modal, the page will not load at all. To try it out, navigate to: /wp-content/themes/companyofcars/partials/modals and remove the underscore before “searchform.php”. This will attempt to overwrite the parent theme (motors) search modal, but will break the site. Perhaps we’ve included the shortcode improperly in this file — I’m not sure!

    We’ve tried turning off the preloader, but there still seems to be breaking errors on load without it.

    Would love to see if you can get some insight into this! Thank you,
    Joshua

    #10115
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Thank you for the details, they helped me a lot!

    I have found the problem. The quotes in the shortcode were invalid characters, probably generated when it was copy/pasted. I’ve corrected the code, plus I added a style for the old search to be hidden 🙂

    I’ve also noticed that the search checkboxes were not working, because of a 3rd party theme script called jQuery uniform. It basically wraps up every checkbox and radio button on the page within a container for better styling – touching the search layout as well irresponsibly, causing it to malfunction and not to display them.

    I had to make the following corrections in the wp-content\themes\motors\assets\js\app.js file on line 236, changed from:

    $(":checkbox,:radio").uniform({});

    to:

    $(":checkbox,:radio").each(function(){
      var parent = $(this).parent();
      var i = 0;
      while ( !parent.hasClass('wpdreams_asp_sc') ) {
        i++;
        if ( i > 10 ) {
          $(this).uniform({});
          break;
        }  
        parent = parent.parent();
      }
    });

    This change of course is not permanent, once the theme is updated it will disappear. I will try to come up with a better workaround for the upcoming release. I assume other theme developers are using this script as well for some reason, so I better look into it.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #10116
    bosh
    bosh
    Participant

    Hey! That’s brilliant. I really appreciate your prompt help.

    Yes, I can deal with that javascript somehow — thanks for hunting down the issue.

    I’ll leave a nice review on CodeCanyon. Cheers!

    #10117
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Search bar breaking site when inserted in modal window’ is closed to new replies.