Get almost 100% PageSpeed on Newspaper theme

62
Get almost 100% PageSpeed on Newspaper theme

The newspaper theme is a most popular premium theme for self-hosted WordPress blog. The theme is developed by team tagDiv. You can buy this theme from ThemeForest. The theme comes with great features. The theme package contains some premium plugins which are listed below –

  • Mobile theme plugin
  • TD Composer plugin
  • Js Composer plugin
  • Social Counter plugin
  • Speed Booster plugin
  • Revolution Slider plugin

Theme developers have provided great support forum and tutorials for step by step setup. They have also provided PageSpeed guide to speed up your blog. You can buy Newspaper theme here.

Here, I am going to share some simple ideas which I have learned while optimizing my own blogs.

I am considering you have self-hosted WordPress blog with Newspaper theme active.

Install WP Super Cache

WP Super Cache plugin is a recommended cache plugin by tagDiv. It serves static contents to the visitor which improve page load speed.

Setup CloudFlare

CloudFlare is a free CDN which cache all the resources from your website and serve them to the users from their servers which are located across the globe. This reduces the load time of your website.

Options you have to enable on CloudFlare’s dashboard.

In your CloudFlare’s dashboard go to speed option. In the Auto minify check for-

  • JavaScript
  • CSS
  • HTML

minify_cloudflare

Scroll down, under the Rocket Loader settings, check Automatic this will improve load time for pages that include JavaScript.

enable-rocket-loader

Browser Caching – Add Expire Headers to WordPress

We are almost done here, now will go with sensitive part of this tutorial. You have to modify the code in .htaccess the file. If anything goes wrong while editing, .htaccess your site may show a blank page or Error 500.

You have to add below code to your .htaccess file. Just copy and paste the following code-

NOTE: If you have Optimize Website module enabled. It is located in your cPanel under Software. Then just remove the following code from a .htaccess file. It is highlighted with red color in above code.

<IfModule mod_deflate.c>
<filesMatch "\.(js|css|woff|html|php)$">
SetOutputFilter DEFLATE
</filesMatch>
</IfModule>

Fix The admin-ajax.php Slow Problem

As discussed with the tagDiv team it confirmed that theme uses admin-ajax.php almost for every block to request the Server and many of the features theme uses this way to query the server and may increase WordPress server load time.

So, to reduce admin-ajax requests trim down the block ajax options meaning the blocks pagination and ajax filters. Turn off the Ajax view count. Also, make sure you do not use too many different types of blocks. It’s better to check my guide to reduce admin-ajax server load in WordPress.

Install Lazy Load

You can reduce numbers of REQUESTS by installing Lazy Load plugin. Though theme has it’s inbuilt lazy load feature. Basically, it does not Lazy load images on your website, it just adds animation to your images.

Note: Don’t forget to disable theme’s inbuilt Lazy Load animation from Newspaper theme panel.

Install tagDiv Speed Booster plugin

tagDiv speed booster plugin comes with Newspaper theme bundle. It compresses all the Stylesheets and JavaScripts and moves them to the bottom of the page. This will Eliminate render-blocking JavaScript and CSS.

Removing Font Awesome

To use icons in the theme, you have to use Font Awesome plugin. There are LOT of icons, and if you’re not using them, then there’s no point in loading all of them.

You need some of these icons for various elements throughout the theme. So you can add a little filter to script so that it only loads essentials.

To do so, put the following code in your theme’s functions.php file.

add_filter( 'infophilic_fontawesome_essentials', 'infophilic_fontawesome_essentials' );
function infophilic_fontawesome_essentials()
{
 return true;
}

Removing Emojis

If you not using Emojis on your site then there’s no need to load them in the back-end. So you can remove it by adding following code in theme’s functions.php

add_action( 'init', 'infophilic_disable_wp_emojicons' );
function infophilic_disable_wp_emojicons() 
{
 // all actions related to emojis
 remove_action( 'admin_print_styles', 'print_emoji_styles' );
 remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
 remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
 remove_action( 'wp_print_styles', 'print_emoji_styles' );
 remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
 remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
 remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
}

Removing other scripts

Newspaper theme comes with inbuilt embed script so there’s no need to use embed script by the core WordPress. It’s it better to deregister by adding following code to the end of your theme’s functions.php file. This will also reduce HTTP requests to the server.

// Remove WP embed script
function infophilic_stop_loading_wp_embed() {
if (!is_admin()) {
wp_deregister_script('wp-embed');
}
}
add_action('init', 'infophilic_stop_loading_wp_embed');

Remove Scripts by Jetpack

Jetpack is one of the best plugins to enhance functionality and the security of your WordPress site. Jetpack’s single sign-on (SSO) feature is the best option to deal with the brute force attacks. Use my guide to enable single sign-on for your WordPress site. But the scripts and the CSS that been loading by Jetpack are not necessary for this. So it’s better to remove them. Add following code to your theme’s functions.php to remove scripts by Jetpack plugin.

//Remove Jetpack css
add_filter( 'jetpack_implode_frontend_css', '__return_false' );

//Remove Jetpack script 
function jeherve_dequeue_devicepx() {
wp_dequeue_script( 'devicepx' );
}
add_action( 'wp_enqueue_scripts', 'jeherve_dequeue_devicepx' );

Conclusion

That’s it, you are done with the optimization now check your website’s performance score at GTMetrix.com. I am sure you are much satisfied with the speed. If you stuck somewhere feel free to drop a comment below.

Hey, wait!!
Don’t forget to share this tutorial on your social networks.  Thanks for reading 🙂