Wordpress compress components with gzip

If you want to  compress your wordpress site  add these code to your site htaccess

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddType x-font/otf .otf
AddType x-font/ttf .ttf
AddType x-font/eot .eot
AddType x-font/woff .woff
AddType image/x-icon .ico
AddType image/png .png

Create a WordPress Plugin

1. Create a folder with your name in plugin folder
2. Create a php file same name  as your plugin name
3. Add this line to your plugin file
   Plugin Name: ravindrasearch
   Plugin URI: http://ravindrasearch.com
   Description: <strong>WordPress 3.5 + ONLY.</strong> Enhance your Search Engine and more.

   Author: Ravindrasearch
   Version: 1.0.0
   Author URI: http://www.ravindrasearch.com/
   See readme.txt
4. Activate Plugin from wp-admin
5. Add this line to prevent direct Access to your page

defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
define( 'ravindrasearch__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );

6.Add Intial function to start your program
 add_action('init', array('advanced-searchform', 'init'));

here  advanced-searchform  is a function name that is for frontend


No comments:

Post a Comment