• I’ve got two wp dashboards, and I want to export all the pages from one to another. However, when I export them, the jquery loader runs after the page already loaded, causing all my custom js functions to not work.

    here is the console, as you can see the javascript functions are trying to run before the jquery loads. Im using jquery noconflict – jQuery(function($) {}

    Here are the functions:

    Im sure this problem is caused by the exportation, because when I imported the xml file in the same dashboard where I imported it, it ran into the same problem.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    What’s odd is jQuery being loaded after .ready(). .ready() is what we normally use to ensure jQuery had already loaded. You should be using it in your noConflict wrapper as well, not that it’ll solve the current issue. I’m guessing jQuery is loaded from the footer and .ready() fires before jQuery can finish loading, a race condition. To ensure jQuery has time to load, it should be loaded from <head>.

    Your pages don’t appear to be following WP script conventions which are intended to avoid issues like this. It’s OK to deviate on your own site as long as it works, but it’ll that much less portable to other sites. What should happen to follow WP convention is all scripts are contained in external files which are enqueued with wp_enqueue_script(), which accepts data on what dependencies exist for the file, such as jQuery. Then the WP loader ensures the scripts are loaded in appropriate order. Then all scripts should be portable to any WP installation.

Viewing 1 replies (of 1 total)
  • The topic ‘Exporting wp pages and importing to another dashboard causes jquery malfunction’ is closed to new replies.