Web Font Optimization – Compress, opentype .otf, eot .eot, truetype .ttf, & woff fonttype

To optimize Web Font Optimization – Compress, opentype .otf, eot .eot, truetype .ttf, & woff fonttype using gzip or deflate  compression you need to add the following code in .htaccess file

keep-calm-and-woff-woff

<IfModule mod_deflate.c>
Addtype font/opentype .otf
Addtype font/eot .eot
Addtype font/truetype .ttf

AddType application/x-font-woff  .woff
AddOutputFilterByType DEFLATE font/opentype font/truetype font/eot
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
</IfModule>
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

# Leverage Browser Caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg “access 1 year”
ExpiresByType image/jpeg “access 1 year”
ExpiresByType image/gif “access 1 year”
ExpiresByType image/png “access 1 year”
ExpiresByType text/css “access 1 month”
ExpiresByType text/html “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType text/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 1 month”
</IfModule>
<IfModule mod_headers.c>
<filesmatch “\.(ico|flv|jpg|jpeg|png|gif|css|swf)$”>
Header set Cache-Control “max-age=2678400, public”
</filesmatch>
<filesmatch “\.(html|htm)$”>
Header set Cache-Control “max-age=7200, private, must-revalidate”
</filesmatch>
<filesmatch “\.(pdf)$”>
Header set Cache-Control “max-age=86400, public”
</filesmatch>
<filesmatch “\.(js)$”>
Header set Cache-Control “max-age=2678400, private”
</filesmatch>
</IfModule>

 

#tags

woff font type gzip

ttf font zip

 

 

 

remove render-blocking javascript typekit

To resolve the render-blocking javascript typekit fonts which shows in Google Pagespeed insight all you need to do is add async attribute in the script. For example:

Before:

<script src=”https://use.typekit.net/ota8ujp.js&#8221; async></script 

After

<script src=”https://use.typekit.net/ota8ujp.js&#8221; async></script

Also put the script to footer so that it does not cause the render-blocking anymore

Remove render-blocking javascript in google maps

To resolve the render-blocking javascript in google maps which shows in Google Pagespeed insight all you need to do is add async attribute in the script. For example:

Before:

<script src=”https ://maps. googleapis .com/maps/api/js?v=3.exp&sensor=false” ></script

After

<script src=”https ://maps. googleapis .com/maps/api/js?v=3.exp&sensor=false” async></script

Try to add the Google Map manually instead of plugin if it is not possible otherwise to resolve the render-blocking javascript in google maps

Remove Emoji js from WordPress wp-includes/js/wp-emoji-release.min.js

To Remove Emoji js from WordPress wp-includes/js/wp-emoji-release.min.js add the following line of code in your theme’s functions.php file

emoji

// REMOVE EMOJI ICONS
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
If you don’t know about functions.php use this plugin instead
#tags
remove emoji js wordpress

WordPress HTML Compression

Resources for the purpose of  WordPress HTML Compression

Thes best way to minify HTML when everything else fails

A single small line of code within the index.php file will do the job. Just add ob_start('ob_gzhandler'); on top of your index.phplocated in the root directory of your WordPress installation:

Just add ob_start('ob_gzhandler'); on top of your index.phplocated in the root directory of your WordPress installation:

<?php
ob_start('ob_gzhandler');
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

 

Also check in the cPanel that the following setting is enabled.html-compression-server-setting

 

 

minify html plugin for WordPress

Good Plugin [Tested and verifed] for the minify html purpose available at GitHub

gmt-html-minify

Minify HTML

http://zurb.com/forrst/posts/Wordpress_Minify_output_HTML-29q

Disable Gravatar in WordPress and fetched Avatar Locally

To disable Gravatar in WordPress and fetched Avatar Locally you need to follow simple steps.

  1. Go to admin section.
  2. Go to setting-> Discussion
  3. Go to bottom under Avatar section choose “Mystery Person”, if you want image other then mystery person download  Add New Default Avatar plugin which willAdd new option to the Default Avatar list.
  4. Done

If there are still some instance where Gravtar images are displayed then add the following line of code in your functions.php file.

// Remove Gravatar
function bp_remove_gravatar ($image, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir) {

$default = get_stylesheet_directory_uri() .’/images/avatar.jpg’;

if( $image && strpos( $image, “gravatar.com” ) ){

return ‘<img src=”‘ . $default . ‘” alt=”avatar” class=”avatar height=”40px” width=”40px”” />’;
} else {
return $image;

}

}
add_filter(‘bp_core_fetch_avatar’, ‘bp_remove_gravatar’, 1, 9 );

function remove_gravatar ($avatar, $id_or_email, $size, $default, $alt) {

$default = get_stylesheet_directory_uri() .’/images/avatar.jpg’;
return “<img alt='{$alt}’ src='{$default}’ class=’avatar avatar-{$size} photo avatar-default’ height='{$size}’ width='{$size}’ />”;
}

add_filter(‘get_avatar’, ‘remove_gravatar’, 1, 5);

function bp_remove_signup_gravatar ($image) {

$default = get_stylesheet_directory_uri() .’/images/avatar.png’;

if( $image && strpos( $image, “gravatar.com” ) ){

return ‘<img src=”‘ . $default . ‘” alt=”avatar” class=”avatar” width=”40″ height=”40″ />’;
} else {
return $image;
}

}
add_filter(‘bp_get_signup_avatar’, ‘bp_remove_signup_gravatar’, 1, 1 );

Reference

http://www.adminblog.com/wordpress-remove-gravatar/

 

#Tags

get rid of gravatar wordpress

custom avatar wordpress

change wordpress avatar without gravatar

simple local avatars wordpress

wordpress change user profile picture

[RESOLVED] Fix WordPress Admin Issues easily with CloudFlare Page Rules

To fix Fixing WordPress Admin Issues with CloudFlare Page Rules

  1. Login CloudFlare account
  2. Go to Page Rules
  3. Click Create Page Rules
  4. type your full website like this url e.g. http://yourdomain.com/wp-admin/*
  5. Click Add a setting then select Disable Security, again click on Add a setting  and this time choose and for the last time click Add a setting then select  Disable performance.
  6. Save and Deploy the rule
  7. Follow the step 3 to create the rule and this time for wp-login.php. Type your domain like this http://yourdomain.com/wp-login.php* and create the same 3 rule that we have created in step 5. Click Add a setting then select Disable Security, again click on Add a setting  and this time choose and for the last time click Add a setting then select  Disable performance.
  8. Save and Deploy the rule.
  9. Done.

wp-loginphp-cloudflare-page-rules

 

 

#Tags

cloudflare wordpress admin issue

cloudflare exclude wordpress admin