• Resolved tskraft

    (@tskraft)


    Hello,

    I develop a website with jquery.smartmenus.js and sudoslider. You can see both plugin in action at the top of the website. However – after loading tablepress in the template file via tablepress_print_table, these plugins stop to work.

    Here is the relevant part to enqueue my jqery scripts and css. Thank you very much!

    add_action(‘wp_enqueue_scripts’, ‘my_scripts’);

    function my_scripts() {
    wp_enqueue_style(‘css-bootstrap’, get_bloginfo(‘template_url’).’/css/bootstrap.min.css’); //bootstrap 3.3.6
    wp_enqueue_style(‘sm-core-toggle-clean’, get_bloginfo(‘template_url’).’/css/sm-core-css.css’); //jquery-smartmenus
    wp_enqueue_style(‘styles’, get_bloginfo(‘template_url’).’/css/styles.css’, array(‘css-bootstrap’)); //sonstige Stile
    /* eigene jquery-Version verwenden */
    wp_deregister_script( ‘jquery’ );
    wp_register_script( ‘jquery’, get_bloginfo(‘template_url’).’/js/jquery-1.11.3.min’);
    wp_enqueue_script( ‘jquery’, ”, false, true );
    // für Accordion ben?tigte Bootstrap-Skripte
    wp_enqueue_script(‘bootstrap-components-js’, get_bloginfo(‘template_url’) . ‘/js/bootstrap-components.js’, array(‘jquery’),false, true);
    //Sudo-Slider im Seitenkopf
    wp_enqueue_script(‘sudo-js’, get_bloginfo(‘template_url’) . ‘/js/jquery.sudoSlider.min.js’, array(‘jquery’),false, true);
    // Hauptmenü über jquery.smartmenus.js
    wp_enqueue_script(‘sm-js’, get_bloginfo(‘template_url’) . ‘/js/jquery.smartmenus.min.js’, array(‘jquery’),false, true);
    //Aufruf der jquery-Befehle
    wp_enqueue_script(‘main-js’, get_bloginfo(‘template_url’) . ‘/js/main.js’, array(‘jquery’, ‘sm-js’, ‘sudo-js’),false, true);
    }

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    The problem is this:

    /* eigene jquery-Version verwenden */
    wp_deregister_script( ‘jquery’ );
    wp_register_script( ‘jquery’, get_bloginfo(‘template_url’).’/js/jquery-1.11.3.min’);
    wp_enqueue_script( ‘jquery’, ”, false, true );

    You should never load a custom version of jQuery, as this can lead to problems like this.

    regt

    Thread Starter tskraft

    (@tskraft)

    Hallo,

    thank you very much! But the problem is not solved. I removed the three lines of code and loaded a tablepress-table. But now the slideshow and the menu are not working any more. My new functions.php:

    function my_scripts() {
    wp_enqueue_style(‘css-bootstrap’, get_bloginfo(‘template_url’).’/css/bootstrap.min.css’); //bootstrap 3.3.6
    wp_enqueue_style(‘sm-core-toggle-clean’, get_bloginfo(‘template_url’).’/css/sm-core-css.css’); //jquery-smartmenus
    wp_enqueue_style(‘styles’, get_bloginfo(‘template_url’).’/css/styles.css’, array(‘css-bootstrap’)); //sonstige Stile
    wp_enqueue_style(‘tablepress-default’, get_bloginfo(‘template_url’).’/css/tablepress-default.css’, array(‘styles’));

    wp_enqueue_script( ‘jquery’, ”, false, true ); // load builtin jquery

    // für Accordion ben?tigte Bootstrap-Skripte
    wp_enqueue_script(‘bootstrap-components-js’, get_bloginfo(‘template_url’) . ‘/js/bootstrap-components.js’, array(‘tablepress-datatables’),false, true);

    //Sudo-Slider im Seitenkopf
    wp_enqueue_script(‘sudo-js’, get_bloginfo(‘template_url’) . ‘/js/jquery.sudoSlider.min.js’, array(‘tablepress-datatables’),false, true);

    // Hauptmenü über jquery.smartmenus.js
    wp_enqueue_script(‘sm-js’, get_bloginfo(‘template_url’) . ‘/js/jquery.smartmenus.min.js’, array(‘tablepress-datatables’),false, true);

    //Aufruf der jquery-Befehle
    wp_enqueue_script(‘main-js’, get_bloginfo(‘template_url’) . ‘/js/main.js’, array(‘tablepress-datatables’, ‘sm-js’, ‘sudo-js’),false, true);

    }

    I took care that my scripts are loaded even behind the jquery-datatables.js. The same problem if I do not load a table, but load the builtin jquery instead of my former custom jquery.1.12.4.

    Thank you very much!

    • This reply was modified 7 years, 3 months ago by tskraft.
    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    why are you doing all this custom JS script loading? I don’t really recommend this, as it’s usually not stable and error prone.

    In your case, the problem is now in the file https://fabulashbeauty.de/wp-content/themes/neuentwurf/js/jquery.sudoSlider.min.js, from what I can see. When I open the JS error log console in the browser, there’s an error reported for that file. This then leads to all other JavaScript no longer working. Is that file maybe relying on the $ being mapped to jQuery (which it isn’t in the jQuery that comes with WordPress)?

    Regards,
    Tobias

    • This reply was modified 7 years, 3 months ago by TobiasBg.
    Thread Starter tskraft

    (@tskraft)

    Thank you! I replaced every occurence of $ with jQuery in the SudoSlider Script, and now the error disappeared.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘My other jquery plugins stop to work after loading tablepress’ is closed to new replies.