• Resolved tzdk

    (@tzdk)


    Is there any reason why outdated jQuery 1.8.3 and Masonry files are hardcoded from theme folder?

    From functions.php

    {
    wp_enqueue_script( 'pin-jquery', get_template_directory_uri() . '/js/jquery.js', array( 'jquery' ), '1.4');
    wp_enqueue_script( 'pin-masonry', get_template_directory_uri() . '/js/jquery.masonry.min.js', array( 'jquery-masonry' ), '1.4');
    }

    When Masonry is loaded you make it dependent on jquery-masonry which is a copy of itself, just with new handle. The right one from WordPress is already registered, see script-loader.php

    $scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry.min.js", array('jquery'), '2.1.05', 1 );

    So instead why not use

    wp_enqueue_script( 'jquery-masonry' );

    ? No messing up jQuery and Masonry gets loaded.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Hardcoded jQuery and Masonry files’ is closed to new replies.