How To Compress Images and Minify WordPress Theme Files
WordPress is a popular blogging platform and has quite a few standard php files that come as default with every wordpress theme, for various parts of the theme like Header, Single Post Page, Archive, Sidebar etc., which are frequently called from various pages.
Images used in theme also consume bandwidth if not properly compressed which leads to slower load time of pages, Caching helps lower the load time but minifying files with code like the php files and compressing the images in the themes makes it even smaller in size helping improve load time of webpages.
GZip compression helps reduce bandwidth compression, [ Check If Your WebPages are Compressed Using GZIP Compression].
WP Plugins that help improve Blog Loading Time –
- WordPress SmushIt Plugin – Automatically compresses images while uploading in WP
- WP Super Secure and Fast htaccess Plugin
- WP Super Cache – For Caching WebPages
CSS Compression is done using CSSTidy an open source CSS parser and optimizer and Minify is done using either JSMin or Packer, either of which can be selected from the settings page.
The plugin creates a new theme from the original theme folder Creates copy of theme, leaving original intact after compressing and minifying as it is difficult to edit a minified file(s).To minify and compress your theme first download and upload the plugin to the plugins folder and activate the plugin.
Once activated the settings for the plugin can be found “ Settings –> Theme Minifier ”.
- Select the theme that you intend to compress and minify.
- Check CSSTidy to compress CSS
- Select JS Compression Method – JSMin / Packer.
- Press “Minify It”.
Once the compression and minify is complete the list of all files with the details like old file size and new file size and total saving in size and percentage is shown.