Plugin Directory

Performance Optimization: Order Styles and Javascript

Ordering stylesheet and JavaScript (external and inline) for performance optimization.

  1. Donwload the plugin from WordPress Plugin Directory (http://wordpress.org/extend/plugins/)
  2. Upload order-styles-js.php to the /wp-content/plugins/ directory
  3. Activate the plugin
  4. Please, add the following lines of PHP code at header.php file where you see <head> section. You need to add only PHP lines given below. HTML code is for demonstration purpose only. Mime type "UTF-8" is my blog's mime type. Mention your blog's mime type in meta tag. If "Content-Type" is not available (suppose) in your WordPress header.php file, then no worry, you can add the 1st part just after <head>.

<head>

<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<?php
// 1. After Head start section
if (function_exists('orderStyleJS')) {
    orderStyleJS( 'start' );
}
?>

<!-- blah blah - any other meta element. Stylesheet - External JavaScript - Internal Js -->

<!-- blah blah - any other meta element. Stylesheet - External JavaScript - Internal Js -->

<?php
// 2. Just before Head close section
if (function_exists('orderStyleJS')) {
    orderStyleJS( 'end' );
}
?>

</head>

Requires: 2.0.2 or higher
Compatible up to: 3.1.4
Last Updated: 2010-8-13
Downloads: 2,617

Average Rating

4 stars
(4 ratings)

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

1 person says it works.
0 people say it's broken.

100,1,1 100,1,1
100,1,1 100,1,1
100,1,1
100,1,1