Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 95994

tzdk on "[Theme: pinpress] Hardcoded jQuery and Masonry files"

$
0
0

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 all articles
Browse latest Browse all 95994

Trending Articles