« Previous Next »

Getting PHP Speedy Plugin to Work with WordPress 2.6

WordPress 2.6 significantly improves the way JavaScript and CSS files can be added to the HTML <head>, and because of these changes the methods of WP_Scripts class have been altered a lot.

Therefore PHP Speedy — my favourit plugin which I think should be incoorporated into the WordPress core — requires the following changes to work with WordPress 2.6.

Replace lines 774 to 787 in php_speedy_wp.php:

if(!method_exists($wp_scripts,'default_scripts')) {
   $wp_scripts = new WP_Scripts();
   $wp_scripts-&gt;default_scripts();
}
 
//Which libraries are used by this installation?
foreach($wp_scripts-&gt;scripts AS $object) {

with:

// check if $wp_scripts is loaded and not empty
if(!is_object($wp_scripts) &amp;&amp; empty($wp_scripts)) {
   $wp_scripts = new WP_Scripts();
}
 
if (method_exists($wp_scripts,'default_scripts')) {
   // if wp 2.5
   $wp_did_register = $wp_scripts-&gt;scripts;
} else {
   // if wp 2.6
   $wp_did_register = $wp_scripts-&gt;registered;
}
 
//Which libraries are used by this installation?
foreach($wp_did_register AS $object) {

Notice that the only change is the $wp_scripts->registered variable which is replacing $wp_scripts->scripts in WordPress 2.6.

 

4 Responses

Mario

Jul 4 at 22:37

#7092

awesome, deserve a try!
and nice design here.

kM

Jul 23 at 18:20

#7489

The plugin is work really great! Thanx for the code!

ghprod

Aug 25 at 17:26

#7796

So is it working with wp 2.6.1?

I’ll try it at home :)

Thnx

Kaspars

Aug 25 at 17:28

#7797

ghprod, yes, it does. Get the latest version of the plugin from the author’s website.

Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line=""> . If you post HTML or PHP code, don't forget to convert it to HTML entities.


About the Author

Written by Kaspars who is a physics student and a graphic designer working on the web since 2000. Read more »

Articles & Bookmarks

From My Feed Reader

Interestingness (Bookmarks)

Around the Web

Delicious findings from around the Web that you may find useful:


Close
Powered by ShareThis