[tutorial] Chris’s custom optimizations for functions.php, etc.

Posted in: Newsmag
Post count: 108

thumbs up for the post!

Post count: 260

Hello

I react on this point I tried:

c) change default WP thumb compression from 90 to 50 (some like 60)

Great for the pagespeed score but OMG all images are now very damaged.

Check for example the first image (and click on it):
http://www.virtualmagie.org/articles/comptes-rendus/conferences-rencontres/duraty/
(Other are links from our old site).
Note the one put on the site is 2362*3539 pixels.

So I think I will do some compress test on fiew images, choose a higher compression (70% ?) and regenerate all images.

Speed is important but quality is important too more now with Retina screens.

If you have experience on that please let me know.

Regards

  • This reply was modified 11 years by Thomas.
Post count: 9544

The purpose of the compression is intended for making the thumbnails very small, not any images which are being enlarged. Idea is that you use large image for “featured image” and then only the thumbs (the little images on indexes and home page, side bar, etc.) get “compressed.”

Obviously you need to adjust to YOUR particular setup. We use 50 on all our sites and looks great for retina on iPad. But we start with images at least 500×375 for interior images, 350px minimum width for vertical inline pix, and our large featured images are 640xNNN.

We don’t compress again using any plugin or jetpack or whatever – you don’t want to “double compress” files. Obviously if using ANOTHER compression method, you don’t need to do both!

Post count: 14

Gettig a error:

WP_Widget error

If you are getting this message on your WordPress installation:

The called constructor method for WP_Widget is deprecated since version 4.3.0! Use
__construct()
Then your theme or plugin need to be updated. As a temporary work around look for define( ‘WP_DEBUG’ true ); in your wp-config.php file and set that to false.

That only causes the warning to not be displayed, the theme or plugin should be updated.

is there already a update ?? having a lot of troubles right now on my site.

Post count: 14

just found the problem, it’s the wpbakery plugin.. is there already a solution?

Post count: 9544

That has nothing to do with the optimization thread — Visual Composer is not part of the theme optimization topic; so please start a new thread please.

Post count: 14

done ,

Post count: 45

Just wanted to say a big thanks to Chris! Your custom code has helped me tremendously in speeding up my site. Even for a beginner like me I got my site to load in 2.3 secs. http://fpt.pingdom.com/#!/eFr269/https://intelrevolution.com
Thanks!
Nate

Post count: 9544

@nateb2127
thanks for the kind words.

I am working on a nice cheap ebook via Amazon which does step by step instructions for optimizing all kinds of things for WordPress, including security, that most folk don’t know how to do properly, and as simply as possible. So, hope to have that done by end of year. 🙂

Post count: 4

Hi

I tried all your tricks and still the site speed is 55 – Can you please advise how to get that improved and what code to put where?

https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Findianbizparty.com%2F&tab=desktop

Post count: 217

My Experience:

Figured out, that the best combination of speed plugins is…Speed Booster + Gator Cache + Autoptimize. Check it out, my site loads blazing fast now!

https://wordpress.org/support/plugin/gator-cache
https://de.wordpress.org/plugins/autoptimize/

Just my two cents 😀

Post count: 9544

@vijayrth11
use gtmetrix.com to debug what you’re missing.
Proper use of gzip/deflate is good for at least 20 points.
Test a post page, not your homepage.

E.g., slow server, slow connection, overloaded plugins, overloaded ad networks, un-optimized images, etc., all contribute to low rating.

Post count: 4

Hi Chris

thanks, Just 2 issues it is showing:

Leverage browser caching
F (9)
Defer parsing of JavaScript

can you please advise or guide how to get these fixed please.

Post count: 9544

You need to use the code from this thread to add the elements to your htaccess file as that is how you specify the “time to live” (expiration headers) — so that browsers know to cache info not updated regularly (like CSS or fonts), and not ask for it every time page loads. See first page of this topic 🙂

Post count: 260

Hello

Notice for those using the Chris code and JetPack.

If you want JetPack connect with WP you have to remove this code in the .htaccess

<IfModule mod_alias.c>
RedirectMatch 403 /xmlrpc.php
</IfModule>

Plus, dev from JetPack told me that this code seems to be not very good for the security:

That’s the problem, Jetpack requires XML-RPC to operate, but now we’re blocked.

Unfortunately, blocking XML-RPC is not a great solution for fighting security risks. It’s akin to selling your car because you don’t want it to be stolen.

Your site’s XML-RPC file is kind of like a communication gateway to your site. Jetpack, the WordPress Mobile Apps, and other plugins and services will use this file to communicate to your site. If this is blocked, you will have other issues pop-up down the road for the same reasons.

Regards

Post count: 9544

@Thomas …. Yes, well considering how many security flaws Automattic has had the past decade they are not really reliable on the topic. (sort of kidding there … 🙂 )

FOR EVERYBODY ON THIS ISSUE:
One of my friends news portals in Ohio was completely taken down by hackers pummeling the xml-rpc feature which ANYBODY can attempt to access remotely for all sorts of things. Site was down for almost two days, host disabling account, etc., — I had him disable this to get the site back up, then they blocked the IPS of the attacker.

If you’re using a WP feature like Jetpack — which is awful system hog and site slower-downer, or WP mobile apps (um, why not just use iPad and login into your normal account… or use other tools that don’t need THAT function?).

UPSHOT: for “most” people disabling all XLMRPC and pingback features are wise if you run any sizable site with lots of traffic. You will get attacked at some point.

And it should be self evident if you’re adding ANYTHING to your site from this thread you should make some effort to explore what these things do, what they mean, etc.

So, you shouldn’t be adding anything to your functions file or htaccess regarding the xmlrpc.php file unless you make some effort to look at what that does.

Having used WP for 10+ years now, remember this thread was started to show folks how to “best optimize” their theme for WP — one of those methods is to NOT use ping-backs, XMLRPC or Jetpack, which is not very well optimized for web.

Keep in mind WP folk think a CSS redirect for child themes is good idea, when it’s a bad thing for page speed and Google as it’s a redirect for EVERY page load to another page.

Those are my three cents, your mileage may vary — as I often say.

But that was good info for Jetpack folk, Thomas! 🙂

  • This reply was modified 10 years by simchris.
  • This reply was modified 10 years by simchris.
  • This reply was modified 10 years by simchris.
Post count: 89

Hi,

I am loading my Jquery from the google libraries instead of from server.. i was wondering what is the most compatible Jquery version to use.. at the moment i have 2.1.4 ? I think it may be the latest version, but i’m not sure.. but i don’t think this recent version supports many of the older browsers such as IE 7, 8, 9 etc..

Any information on this topic would be great!

Thanks

  • This reply was modified 10 years by gfran5.
Post count: 9544

Awesome search engine called google, ironically 😉

http://jquery.com/ >> http://jquery.com/browser-support/

https://developers.google.com/speed/libraries/#jquery

I would not worry too much about IE7 or WinXP at this point as that browser is so insecure that pretty much the bulk of the web is starting to kill any support for it; especially SSL connections since SSL2/SSL3, TLS1 are all insecure. Of course some folks want to keep legacy support for the old folks. However, as web heads toward “https everywhere” the oooold browsers simply will not work with TLS 1.2+ connections, probably.

Jquery 2x only works with IE9+.

Hope that helped 🙂

I went through this last year when moving our main business site to “all https all the time” on Dec. 1, 2014, and making the jquery connection https, then deciding to load it locally for speed/caching locally.

Testing your site in old browsers:
The modern.IE site makes available virtual machines for testing many different versions of Internet Explorer. Older versions of other browsers can be found at oldversion.com. https://dev.modern.ie/tools/vms/windows/

Post count: 89

I noticed in the speedbooster file, it is using version 1.11.1 from google instead of the local ones… in this article (http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/) it mentions you should set the google cdn to fallback to the local files if the CDN doesn’t load or isn’t allowed in that country..

this is the code i am using:
function wel_adding_scripts() {
wp_deregister_script(‘jquery’);
wp_register_script(‘jquery’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js&#8217;, ”, ‘1.11.3’, true);
wp_enqueue_script(‘jquery’);
}
add_action( ‘wp_enqueue_scripts’, ‘wel_adding_scripts’ );

Do you know how i could setup a fallback method?

Post count: 9544

Can’t help you with that, so you should put in a NEW thread for that … sorry.

Post count: 9544

For those curious why I’ve been recommending disabling XML-RPC on WP, here is more fuel for the fire on “why I do that …” —

https://blog.sucuri.net/2015/10/brute-force-amplification-attacks-against-wordpress-xmlrpc.html

Post count: 9544

Hello all…
some of you may have noticed in old threads I had suggested using the venerable ADDTHIS plugin if you needed quick “bunch of sharing buttons” for your site without having to do anything custom or fancy; I can no longer recommended AddThis due to an injection of large amount of comment text in every page, which is designed to disable and over-ride “comment removal” systems like mod_pagespeed. So, this broadcasts to everyone you’re using AddThis. Granted it’s a free offering at its basic level, but still not cool.

So, instead we have started using this one, which works great with the theme automatically, putting the “top” sharing items at bottom of post for those who want share buttons without bandwidth/page load affecting “counters” … if you just want people to be able to share stuff… this one works very well, and super lightweight:

(loads in under 5 msec.)

Simple Share Buttons Light
https://wordpress.org/plugins/simple-share-buttons-light/

A ‘pro’ version adds additional bells, whistles,

Post count: 59

Hi @Chris S I would like to talk to you as soon as possible, where can I contact you?

Thanks

Post count: 9544

For those with a dedicated web server, or VPS on shared hardware:

Make sure your server has 10/100/1000 switch vs 10/100 switch/connection in datacenter. Most older hosting companies only provide a 10/100 connection to the network where the modern servers all work better with gigabit switch. Even in our Class A datacenter (owned by IBM) we had to “ask” for that upgrade with our newest server package end of 2013, which was dumb. Now in 2015 they finally made that “standard” — but some still won’t give it to you unless you ask, or in some cases pay an extra $10/mo or whatever — it’s totally worth it as you have a 10x faster connection to the net for your physical box.

Post count: 88

Nice guide. I am trying to decipher your suggestions.

What does this part actually do?
remove_action( 'wp_head', 'wp_generator' ) ;
remove_action( 'wp_head', 'wlwmanifest_link' ) ;
remove_action( 'wp_head', 'rsd_link' ) ;
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );

Viewing 25 posts - 76 through 100 (of 182 total)
You must be logged in to reply to this topic.