{"id":10054,"date":"2010-08-11T17:37:49","date_gmt":"2010-08-11T17:37:49","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/performance-optimization-order-styles-and-javascript\/"},"modified":"2013-10-11T09:46:09","modified_gmt":"2013-10-11T09:46:09","slug":"performance-optimization-order-styles-and-javascript","status":"publish","type":"plugin","link":"https:\/\/lmo.wordpress.org\/plugins\/performance-optimization-order-styles-and-javascript\/","author":4346301,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0","stable_tag":"1.0","tested":"3.6.1","requires":"2.0.2","requires_php":"","requires_plugins":"","header_name":"Performance Optimization: Order Styles and Javascript","header_author":"Satya Prakash","header_description":"","assets_banners_color":"","last_updated":"2013-10-11 09:46:09","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/www.paypal.com\/cgi-bin\/webscr?cmd=_s-xclick&hosted_button_id=JCVH4RPHL4P5G","header_plugin_uri":"http:\/\/www.satya-weblog.com\/?p=2392","header_author_uri":"http:\/\/www.satya-weblog.com\/","rating":5,"author_block_rating":0,"active_installs":80,"downloads":13428,"num_ratings":6,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":{"1.0":"<ul>\n<li>Removes the empty Script tag you may be getting in case you do not have any inline script in Head section.<\/li>\n<li>Correction in Readme.txt file.<\/li>\n<li>Bug fixed when there was an style (&lt;style&gt;&lt;\/style&gt;) tag inside head section.<\/li>\n<\/ul>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"7"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.6","1.0"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[356,187,247,794,1976],"plugin_category":[52,54],"plugin_contributors":[83424],"plugin_business_model":[],"class_list":["post-10054","plugin","type-plugin","status-publish","hentry","plugin_tags-css","plugin_tags-optimization","plugin_tags-performance","plugin_tags-speed","plugin_tags-style","plugin_category-performance","plugin_category-security-and-spam-protection","plugin_contributors-satya61229","plugin_committers-satya61229"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/performance-optimization-order-styles-and-javascript.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Did you ever read about Optimization of website\/blog through ordering styles and Scripts in head section? \nIf you like your website load in browser as quickly as possible then you may have read in performance optimization tips that \nyou should move all CSS files on top and script at last in HTML head section &lt;head&gt;&lt;\/head&gt;.<\/p>\n\n<p>How do you order those calls? If you are manually putting CSS and JavaScript files in head section (&lt;head&gt;&lt;\/head&gt;),\nthen you can do this very easily. Just modify once and optimization for this is over. \nWhat if you are using plugins and that are adding calls to JavaScript and CSS files dynamically. This is case of Wordpress blog,\nwhere we use many plugins and those plugins add various Styles and Script files dynamically from wp_head() call.<\/p>\n\n<p>If above lines, do not makes much sense to you then probably you have not \nread this documentation on <a href=\"http:\/\/code.google.com\/speed\/page-speed\/docs\/rtt.html#PutStylesBeforeScripts\">Google<\/a>.<\/p>\n\n<p>The plugin will also collect different inline scripts to one place. Thus making the source code\nlook better.<\/p>\n\n<p>To check, if the plugin is doing anything or not, compare the Head section before and after \nactivating the plugin.<\/p>\n\n<p>(For reading more details discussion, follow the Plugin link on right side.)<\/p>\n\n<p><a href=\"http:\/\/profiles.wordpress.org\/satya61229\">Author (satya61229) About page on WP<\/a><\/p>\n\n<!--section=installation-->\n<ol>\n<li>Donwload the plugin from Wordpress Plugin Directory (http:\/\/wordpress.org\/extend\/plugins\/)<\/li>\n<li>Upload <code>order-styles-js.php<\/code> to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Active the plugin<\/li>\n<li>Add the following lines of codes at header.php file where you see &lt;head&gt; section.\nYou need to add only PHP lines given below. HTML code is for demonstration purpose only. \nMime type \"UTF-8\" is my mime type. Mention your mime type meta tag. It will just there cut and paste just after \nHead section. If \"Content-Type\" is not available (suppose) in your Wordpress header.php file, \nthen no worry, you can add the 1st part just after &lt;head&gt;.<\/li>\n<\/ol>\n\n<p>&lt;head&gt;<\/p>\n\n<p>&lt;meta http-equiv=\"Content-Type\" content=\"&lt;?php bloginfo('html_type'); ?&gt;; charset=&lt;?php bloginfo('charset'); ?&gt;\" \/&gt;<\/p>\n\n<pre><code>&lt;?php\n\/\/ 1. After Head start section\nif (function_exists('orderStyleJS')) {\n    orderStyleJS( 'start' );\n}\n?&gt;\n<\/code><\/pre>\n\n<p>&lt;!-- blah blah - any other meta element. Stylesheet - External JavaScript - Internal Js --&gt;<\/p>\n\n<p>&lt;!-- blah blah - any other meta element. Stylesheet - External JavaScript - Internal Js --&gt;<\/p>\n\n<pre><code>&lt;?php\n\/\/ 2. Just before Head close section\nif (function_exists('orderStyleJS')) {\n    orderStyleJS( 'end' );\n}\n?&gt;\n<\/code><\/pre>\n\n<p>&lt;\/head&gt;<\/p>\n\n<!--section=faq-->\n<dl>\n<dt>Is this plugin useful for every wordpress installation?<\/dt>\n<dd><p>This plugin should work in any Wordpress version. However, I will recommend using it to only those Wordpress installation where any caching system is in use. Remember, every code takes resources even if it is smaller. My code is not an exception. So, if you are using any caching system then the plugin code need not run every time a request is made for a page on your website\/blog.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.1<\/h4>\n\n<p>Just a ReadMe Refresh to tell WP that everything is still fine and work perfectly.<\/p>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>Correction in Readme.txt file. <\/li>\n<li>Removed empty script tags coming in case there was no inline script in head section.<\/li>\n<li>Bug fixed when there was an style (&lt;style&gt;&lt;\/style&gt;) tag inside head section.<\/li>\n<\/ul>\n\n<h4>0.5<\/h4>\n\n<ul>\n<li>Order external stylesheets files and External and Internal JS<\/li>\n<\/ul>","raw_excerpt":"Ordering StyleSheet and JavaScript (external and inline) for performance optimization.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/10054","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=10054"}],"author":[{"embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/satya61229"}],"wp:attachment":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=10054"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=10054"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=10054"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=10054"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=10054"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=10054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}