Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Too Much jQuery Loading WordPress

  • SOLVED

Hey fellas and ladies...

I have a video tutorial blog located here: [[LINK href="http://wikispacetutorials.com"]]http://wikispacetutorials.com[[/LINK]]. I have a number of different plugins to help with the functionality of the blog, and after testing it a bit within Firebug's YSlow tool, <em>I think I found jQuery being loaded separately for a lot of those plugins.</em>

<strong>I would like to find a way to access one jQuery file from the Google API for each of those plugins</strong>, instead of loading the same jQuery min file separately for each of the plugins, which I imagine is causing the site to load a bit slower. I'm assuming that's the best way for each of the plugins to work, if they are all pulling in the default jQuery file.

I also am wanting to launch a membership club, of which I've already found a really great plugin for. However, I'd like to use the JW-FLV player plugin for Wordpress. I've been using Vimeo, and simply uploading my .MOV files from Screenflow to the Vimeo site, and then just embedding the Vimeo code within each tutorial post. But since the Vimeo video can be accessed via the web, and won't be protected, I'll need to use the JW Player.

So, I'm having problems with 1) converting my .MOV files to .FLA or .SWF to be used with the JWPlayer, since (as I understand it), those 2 file types are the only ones that can be used with the Player. And 2) getting the video to look really crisp within the JWPlayer.

Any help you can provide would be greatly appreciated...

Answers (4)

2009-12-11

Dan Davies answers:

With regards to the jQuery issue, try putting the following code before

<?php wp_head(); ?>

in your header.php file:

<?php wp_enqueue_script("jquery"); ?>

That should prevent multiple instances of jQuery being loaded.

For the videos - if screenflow doesn't allow you to export video as .swf, you'll have to look at getting a piece of software to convert .mov files to .swf files. You can find plenty of pieces of software that do that by doing a [[LINK href="http://www.google.com/search?q=.mov+to+.swf"]]Google search[[/LINK]].

Alternatively, you could look into using [[LINK href="http://www.vimeo.com/plus"]]Vimeo Plus[[/LINK]], which allows you to privatise your videos and lock them to a particular domain.

I hope that helps!

2009-12-12

Brandon Dove answers:

@Darfuria is on the right track with the addition of the following code.

wp_enqueue_script('jquery');

One change I'd make is to put the following in your functions.php file:


function pj_add_jquery_scripts () {
wp_enqueue_script('jquery');
}
add_filter ('wp_head', 'pj_add_jquery_scripts', 1);


This basically does the same thing, but doesn't muddy up the template files. The problem is, this won't necessarily solve your multiple loads of jQuery. This will limit the amount of loads you get for developers who use this function to call jQuery in their plugin, but a lot of times developers write script tags out to include it. You'd have to go through each of the plugins you have installed and find where they're including the jQuery library and make sure they're using wp_enqueue_script() too. If they're not, you could change it (or just delete the call all together), but you'd have to go through this process whenever the plugin developer releases an upgrade (or never upgrade the plugins you modify.

As for the videos, I would seriously look into using VideoPress. It's a paid service offered at http://www.wordpress.com (preview features at http://videopress.com/). It can handle very high quality video and it works straight from within your self-hosted WordPress install.

2009-12-12

Utkarsh Kukreti answers:

Hi Spencer,

The issue of multiple instances of jQuery being loaded, is being caused by the plugin [[LINK href="http://wordpress.org/extend/plugins/community-links-feed/"]]Community Links Feed[[/LINK]]
You can resolve that, by editing the line 106 of cj_community_links.php in the wp-content/plugins/community-links-feed/
from
echo '<script type="text/javascript" src="'.$clpath.'jquery-1.3.2.min.js"></script>'."\n";
to
// echo '<script type="text/javascript" src="'.$clpath.'jquery-1.3.2.min.js"></script>'."\n";

This will basically prevent the plugin from loading its own jQuery file on each page load. The theme already includes one instance of jQuery, so the plugin would function properly. This is a bug in the program, as it should have used the WordPress functions to include jQuery in the page.

As for the video, I would highly suggest having a look at [[LINK href="http://www.vimeo.com/plus"]]Vimeo Plus[[/LINK]]. If you convert .mov to .flv, the quality would definitely be lowered, and I wouldn't suggest it. Plus, it would also help reducing the bandwidth consumed in hosting, if you plan to host the video yourself.

2009-12-11

Lawrence Krubner answers:

Spencer, you're asking about several things. You may get different answers for different parts of your question. As such, you may find it best to split the prize money, when your question is answered. Remember, when you hand out the prize money, that this site allows you to split the prize money among multiple answers.