Sep 2016 Compatibility of Chris’s custom optimizations for Newspaper theme.

Posted in: Newspaper
Post count: 436

Hi Chris and @TagDiv Team,

I have been reading Chris’s custom optimizations for functions.php etc tutorial many times and today. I thought to make use of it for my website based on NewsPaper theme.

The sticky post by Chris is meant for NewsMag theme and I have no idea how compatible it is with Newspaper theme. Still I tried the most updated version of his optimisation code with name “/** CUSTOM OPTIM CODE : by Christopher Simmons – REV 8.17.16 */ ” using guidance written under this sticky thread

Here is the full code that I used is here Pastebin link

I also tried “slim version for newspaper them: june 2015” pastebin code here

along with one of above written codes ( not both at the same time)

I also added following things under HTACESS ( my htaccess file is here ), optimise my Database filesusing WP-optimise and WP-Sweep and have optimised my style.CSS using online minifaction tool suggested by Chris.

After trying all these things, though I felt that the backend and front of my site is comparably fast , but no considerable change in Page speed score or GTMatrix score.

Before all these customisation and optimization techniques:( Note: I have disabled all other caching plugins and CloudFlare since last few days to work on live raw site )

GTMATRiX Test Link: Click this

Pagespeed Test Link: Click this
PAGESPPED SCORE: MOBILE: 42 DESKTOP: 48
GTMATRIX SCORE: PAGESPEED SCORE: 56 YSLOW SCORE: 52

After making all these changes: ( Note: I have disabled all other cachine plugins and cloudflare since last few days to work on live raw site )

PAGESPEED SCORE: MOBILE: 42 DESKTOP: 50
GTMATRIX SCORE: PAGESPEED SCORE: 58 YSLOW SCORE: 56

So, the change in very minimal. Previosuly with WP Super cache and cloudflare, my GTmatrix scode used to be 95+gh under various threads here, many users have experienced 98+ pagespeed score after using Chris Techniques.

What am I doing wrong? Does Chris’s codes not support or work for Newspaper theme? Should I finally use slim mini newspaper version or the newsmag theme one ?

Is there any such thread for the NewsPaper theme?

Please help me to get answers for all these issues.

Thank you.

  • This topic was modified 9 years by Nano.
  • This topic was modified 9 years by Nano.
Post count: 22421

Hello,

Well a cache plugin and cdn represent a large part of page speed so you might test with them active.
The core of both themes is the same so Chris’ customization should work on newspaper as well but I cannot say for sure unfortunately.
However this is not an official solution. It is user submitted so Chris is the one with the better answer for it as it’s his guide after-all 🙂

Thank you!

Post count: 436

Thank you Bogdan for the reply. Yes I have already tried these optimisation tips on NewsPaper , but couldn’t notice any big jump in Pagespeed score or so.

Let’s wait for the Chris’s reply if he ever notice this thread.

Thanks again 🙂

Post count: 285

Hi @nano2408,
You can use all the optimization in the world, if your server is “low” forget about all this tips, you’ll have headache.
If it were so simple, why some we pay +700 bucks/year for a good server???

Post count: 9544

Hey party people!

Remember that the gzip/deflate settings on both web server and in htaccess (remember that settings for my stuff is based on Apache servers; needs to be different for NGINX boxes, which are becoming more and more common) are good for 20 points or more alone. That is always first thing you need to address. This is what the server compresses before it sends something to the web browser. It’s mission critical, step one.

For example first item in your GTMetrix test:

Enable compression for the following resources to reduce their transfer size by 424.8KiB (79% reduction).

Also for image compression; re checking any image that can be compressed more than 2KB is good idea as it adds up on image heavy layouts;
eg.
Optimize the following images to reduce their size by 31.8KiB (5% reduction).

Generally you can kind of ignore stuff that says optimize by 322bytes as that is 1/3 of a kb. Unless you want to really go nuts on optimization score (I leave that stuff to last myself).

ALSO; to stop yourself from waking up in the middle of night screaming (oh wait, that’s me), test one of your post pages and not your home page; the home page will always initially have worst score due to so many images being loaded. An “average” post page, is best to tune with as that is 90% of your site traffic and what Google is focused on.

And as an anecdote; my original thread on the optimization was actually for the 2014/15 versions of Newspaper, then I switched to Newsmag when it first came out as it better fit my news portals which get updated daily.

Stuff for htaccess and functions.php are “generally” going to be same between the two themes.

So, I’d tackle the gzip/deflate thing first – as that is your biggest gotcha right now.

Post count: 9544

Also, your host really should be serving up this one properly:

The following publicly cacheable, compressible resources should have a "Vary: Accept-Encoding" header:

I had to get this setup properly on our new server that went live Aug 5, also. SO, have your host fix that; and send them that section with the files — basically the css and js should be serving the “vary …” thing. And that is also part of the proper setup of the gzip/deflate.

Post count: 436

Hey Chris,

Gracious !!!

Thank you for the detailed explanatory reply. As far this system status ( https://snag.gy/P2ApmR.jpg) to be believed , my host run on Apache server and hence the HTACCESS codes written by you under this thread should be valid.

As per recommendation, I started my HTACCESS file with :


<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters rewrite_images
ModPagespeedEnableFilters insert_dns_prefetch
</IfModule>

and then I added following code after default rewrite codes of WordPress:


AddType text/javascript .js
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
 
# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2500000 seconds"
ExpiresByType image/jpeg "access plus 2500000 seconds"
ExpiresByType image/png "access plus 2500000 seconds"
ExpiresByType image/gif "access plus 2500000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2500000 seconds"
ExpiresByType text/css "access plus 700000 seconds"
ExpiresByType text/javascript "access plus 700000 seconds"
ExpiresByType application/javascript "access plus 700000 seconds"
ExpiresByType application/x-javascript "access plus 700000 seconds"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
ExpiresByType font/truetype "access plus 2500000 seconds"
ExpiresByType font/opentype "access plus 2500000 seconds"
ExpiresByType application/x-font-woff "access plus 2500000 seconds"
ExpiresByType image/svg+xml "access plus 2500000 seconds"
ExpiresByType application/vnd.ms-fontobject "access plus 2500000 seconds"
</IfModule>
# END Expire headers
 
# BEGIN Cache-Control Headers
<IfModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</filesMatch>
</IfModule>
# END Cache-Control Headers
 
<IfModule mod_headers.c>
    Header unset ETag
</IfModule>
<IfModule mod_alias.c>
RedirectMatch 403 /xmlrpc.php
</IfModule>
 
<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  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
  AddOutputFilterByType DEFLATE text/xml
 
  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>
 
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?tomatoheart.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

The last code is to prevent hotlinking. Now as far I can read understand from your comment , the above written codes must have taken care of the required gzip/deflate settings through HTACCESS and should add up to 20 points to my score , but it didn’t happen 🙁

I still have these settings under htaccess and have also modified functions.php but the icrement in Pagespeed is only 2-4 points. On other side, I do feel my backend and homepage little faster while using after adding all these things. But there is no such impact on GTMAtrx score.

As you have mentioned :


Enable compression for the following resources to reduce their transfer size by 424.8KiB (79% reduction).

When I have already configured HTACCESS to compress it, why is it still showing there? AM I doing something wrong?

About Image optimisation thing, I use “Insanity plugin” to reduce file size while uploading the image and”optimus plugin” to compress it. the JPEG compression is set to 70 because I am worried to set it to 50 ( as recommended by you) because of the need of image quality. Since I am doing various changes, I will force regernerate and optimise images once I finalise all design aspect of my site.

Though I also tried checking GTMatrix points for my post page ( https://gtmetrix.com/reports/tomatoheart.com/vW3rCLXw ) , but it’s even worst than the homepage ( PAGESPEED SCORE: 53, YSLOW: 51)

about your second reply ( server side optimisation) , Being fron a non-programmer background, I will copy this comment and send it to my hosting provider to ask if they need to do anything.

Do you think there is something you can comment on my current situation.

Thank you.

  • This reply was modified 9 years by Nano.
Post count: 436

Hey nairolf2013,

You may be true about this but just 4 weeks before when I was using old theme , I usually had 94-95 PAGESPEED SCORE on my site, do check this screenshot here: https://snag.gy/fY1TJb.jpg

But yes, a fast server must be having an edge over slower one. 🙂 😉

Cheers,

Post count: 9544

Gzip/Deflate must be properly setup and enabled at the SERVER level; above the domains, above your website; not from htaccess, theme, or WordPress. Two different things. From my test it looks like it is partially setup, but some setting you have is not compressing javascript and css files, it would appear.

a) gzip/deflate must be ON and working; then the directives tell it what to do.

b) for mod_pagspeed — that won’t work unless your host is running mod_pagespeed — and if they don’t have gzip/deflate properly setup it’s highly doubtful that mod_pagespeed is running.

As noted in various places in my long long long thread; you need to go research what some of my things DO to see if they apply to your server setup, otherwise they won’t do anything.

So, again – YOU need to contact your HOST provider, and
a) have them properly setup gzip/deflate — as right now it’s not compressing ALL your content, only some if it, which is not normal.

Your page does show this:
Results

Url : https://tomatoheart.com/aishwarya/10-p-v-sindhu-first-indian-woman-win-olympic-silver/

Parameter Value
Gzip/Deflated enabled ? YES - The url is serving compressed content.
Compressed Size 41.45 KB
Original Size 327.66 KB
Savings 87.35 %
Response header
Content-Encoding: gzip

But as it clearly shows on GTmetrix; and you should provide this to your host –as I stated — to get them to fix, along with the vary accept encoding:

Enable compression for the following resources to reduce their transfer size by 401.2KiB (80% reduction).

Compressing https://tomatoheart.com/wp-content/themes/Newspaper/js/tagdiv_theme.js could save 391.9KiB (80% reduction).
Compressing https://tomatoheart.com/wp-content/plugins/ytsubscribe/ytSubscribe.js could save 4.0KiB (69% reduction).
Compressing https://tomatoheart.com/wp-content/plugins/wp-facebook-login/public/js/facebook-login.js could save 2.3KiB (66% reduction).
Compressing https://tomatoheart.com/wp-content/plugins/akismet/_inc/form.js could save 382B (54% reduction).

That is what is hurting your site speed/rating.

So, that’s about all the help I can provide there

In our setup, we have the server setup to serve gzip/deflate and vary accept encoding without having to add the <IfModule mod_deflate.c> section you have in your file.

Sorry not a better answer 🙂

Post count: 9544

Also note with mod_pagespeed, generally there needs to be a custom line added to the pagespeed.conf file pointing to your static folder, such as /site/wp-content/uploads/ or where your images are, to let mod_pagespeed load https static files via /server/path/ vs via http/https.

If your host isn’t running mod_pagespeed, that is non issue.

Based on your page source it does not appear mod_pagespeed is installed or running for your content.
REF:
https://developers.google.com/speed/pagespeed/module/configuration

Post count: 436

Hey Chris,
Thank you for taking time and making real effort to help me out. 🙂

There are so many layers to your answers and everytime I read it, I find something new to look for.

Here is something important, few days back, I had issues with TD Mobile plugin theme. It was showing mobile responsive version of desktop theme on mobile but not the mobile plugin version. In an answer to my related thread ( read here) , Andrei told me that it’s happening because of strong caching enabled on my hosting site.

And hence I asked my hosting provider to disable caching and they disable all types of caching for my domain. Though after that mobile plugin theme started working but after using it for a while , I felt that mobile theme needs many more featured now. So, I disabled it.

I doubt that these Gzip/deflat things must be part of those caching system and which is currently diabled .

What do you think? Should I ask them to re-enable it?

I will also send the GTMatrix parametre to my hosting prover .I will also ask to check following things:
The following publicly cacheable, compressible resources should have a "Vary: Accept-Encoding" header:
Right?

I will re-read your all your comments and then prepare a mail for my hosting service privder.

Let’s see how it goes. Thank you very much again.

Post count: 9544

You’re very welcome 🙂

I accept gingerbread cookies in my virtual tip jar!

Post count: 9544

( oh, and you do want caching/TTL running for your site, so that the directives to cache stuff work using the server’s opcache/memcache; but do all the optimizations without using any caching plugins, in order to see changes, make changes, etc. — what these do is tell the browser not to keep re-loading things like your logo every time the page loads, or the style sheet, etc., and if they come back tomorrow, page loads quicker as the ‘time to live’ is longer than 24 hours or whatever — this speeds up pages, separate from the gzip/deflate stuff … )

Put another way:
server caching helps the server serve up re-used files quickly without reloading the single files over and over and over.

Caching plugins create a “static” copy of your page for short period of time, so that the whole page can be downloaded as a much quicker element as there are not dbase queries waiting on php processes for 20 things on the page.

Not sure that helps, just anecdotal.

Post count: 436

Okay, I got it, but perhaps my previous comment was little confusing or my ability to comprehend your most recent answer is not good 🙂 So, let me try to make few of my queries simple.

1. I understood the use of caching but couldn’t understand the difference between server side caching and wordpress side caching.
2. Yes, currently I am not running any caching plugin just to check, test and increase the performance without the use of it but then is it possible to get 90+ Pagespeed score without WP Super cache and cloudflare etc ? ( Because I have seen that once I enable these two, my Pagespeed goes above 90 even now)
3. Based on my request ( because of not getting mobile theme run because of server side strong caching ) , my hosting provider has completely disabled all kind of server side caching for my site. Should I ask them to re-enable it?
4. I don’t know why my mobile theme was conflicting with server side caching. So, Is there any way in which I can be specific to instruct only following features under server caching so that I can be able to use mobile theme in future ( currently I disabled mobile theme and using default mobile responsive version of desktop theme?
5. Is it really necessary to use mobile theme because I can see that it kills various necessary features like smart lists on mobile theme ask users to reload page everytime they want to next list number which is very irritating on users poitn of view.

Please try to answer these questions after indulging few of cookies from this cute cookies jar 🙂

 gingerbread cookies in my virtual tip jar

Thank you.

Thank you

Post count: 9544

Sadly i dont use the mobile theme so cant really help with that.

Post count: 260

You have very large waiting and blocking time on timeline resources. That means your server dont work well or its very small for your site and contents. 😛

Post count: 436

@Chris: No issue! Happy to know that you don’t use Mobile theme. Now I will keep using Mobile responsive version of desktop theme in peace till they add some more features to it 🙂

Hello Ing Geek ,

Happy to see you here 🙂

Now I am really upset about my server. Just one month before, I shifted from Hostgator shared hosting to this new Managed WordPress hosting site powered by Google Cloud. I just read that it uses NGINX caching.
(Does it mean I can’t use Apache server based optimization techniques written by Chris> Though the system status under theme panel says it’s CentOS/Apache Server )

In this way, it must be a very powerful and strong platform. But then why is it having ” very large waiting and blocking time on timeline resource”? Is it because I asked them to deactivate all caching from my website?

I have asked a set all the questions raised by Chris above to my hosting provider and now waiting for their reply ( Saturday , Sunday support off) . My server is based in London and they do offer assistance for the modification of PHP variables.

I have also gone through your Spanish optimization code and have noted it down. I am not sure which code I should use but will surely give it a try. ( Sometimes I really think I should be a computer engineer , not electrical )

Let me if you know if you have any other optimization ( or any other ) feedback for my site.

Thank you for your insights.

  • This reply was modified 9 years by Nano.
Post count: 9544

The NGINX vs Apache thing is a tad confusing with the latest web servers; for example I run Apache because I’ve been doing so for 20 years and know it’s tweaks; NGINX works a bit diffferent; and if I didn’t have a legacy 16 year old website to deal with we’d been running NGINX.

Funny thing, even with the new system, NGINX runs in front of Apache to serve http/2 for https, which we have not yet implemented. But the pages are served by Apache (for now).

Your server is likely running opcache/memcache with NGINX, which is good. It speeds up files requested over and over, as I stated. Local caching on your site is different, as it caches the stuff being queried for each page to speed things up since there is no lag time waiting for dbase to serve and render the page (technically with php/wordpress there are no actual “pages” on your site, they all are built dynamically).

So, you likely have a CentOS/Apache setup (as we do here), but NGINX being used for caching.

Generally, you should just tell your host you need your domain optimized for WORDPRESS, and they should be able to do the rest on the backend as far as caching, gzip/deflate, etc.

No support on weekends isn’t good for hosting provider; means they are a reseller and not a “true host” — they are reselling another company’s hosting, which is very common.

In any case, it’s a process — but some of the stuff is NOT theme specific, it’s WordPress specific, meaning the server side tweaks, and general optimization of time to live, caching, expiration headers, image compression, etc., are NOT specific to ANY theme.

So, good to make Google your friend and explore the many articles out there on “speeding up WordPress” — sites like WPBeginner, WPMU, etc.

Post count: 436

Hey Chris,

Thanks again 🙂

This time, it was really easy for me to comprehend whatever you said above.

I received a quick response from my hosting provider saying that they are looking at my suggestions and will see what can be done. But they also repeated that they are not going to change the configuration of the entire server based on individual requests.

Let’s see what happens. Right now I have actovated the Super cache + cloudflare and I am getting pagespeed score of 90+ I will wait for their reponse and then re-look at everything I learn here.

And yes, I am a regular visitor of WPBeginner, WPMU etc. In fact, recently I tweaked my login page without using any plugin based on a nice post on WPMU 🙂

Cheers,

Nano

Viewing 19 posts - 1 through 19 (of 19 total)
The forum ‘Newspaper’ is closed to new topics and replies.