Daily Archives: June 13, 2009 10:50 pm

Changing the plugin file to utilize wordpress 2.8 optimization

Published by:

WordPress 2.8 has been released few days ago.
It come with some sort of optimization.. as many had complaint regarding the placing of
JavaScript at the bottom of the page instead of at the beginning of the page.

As per Yahoo! why slow performance advice has stated that..
JavaScript pulling at the beginning of the page will slow the down the page loading, because it wait the javascript fully
loaded before start pulling the next item of the page.

Unlike the CSS, it tend to block async process before the JavaScript completed..

so , seem like the wordpress developer have heard the complaint..
The have add another argument to the existing function..

Oh.. you might have lost..

in a theme file..

there are normally had

< ?php wp_head(); ?>

and

< ?php wp_footer(); ?>

and for plugin to ‘hook’ onto that part of the page to do something they had to have something like this in the plugin file.

< ?php 
add_action ('wp_print_scripts', 'function_from_this_plugin_file');
function function_from_this_plugin_file () {
 	wp_enqueue_style('wp-name-of-the-plugin', plugins_url('wp-name-of-the-plugin/plugin-css-file.css'), false, '2.50', 'all');
	wp_enqueue_script('wp-name-of-the-plugin', plugins_url('wp-name-of-the-plugin/plugin-js-file.js'), array('jquery'), '2.50', true);
}
?>

the difference between 2.8 and any of previous version is :
Continue reading

Sharing is caring
Sharing is caring