And one I keep forgetting until I do a theme upgrade; this really should have been part of 1.6 core update, but TagDiv helped me with this back on 1.2 or 1.4, which is for the thumbnails used at bottom of posts for “related” items. If you run various pagespeed testing tools, you might get the annoying notice about “not resizing” those images, which are actually 200×150 last time I looked. BUT, the theme resizes them from the 238x thumb vs making new one, when you have the 3 column related items as I do.
SO: here is fix for that; you need to edit /includes/td_config.php
(NOTE: syntax changed from 1.4 to 1.6 with API syntax; so if using older version copy one of the preceding elements and add the additional size).
So, around line 797 in v 1.6 you would need to add this:
td_api_thumb::add('td_200x150',
array(
'name' => 'td_200x150',
'width' => 200,
'height' => 150,
'crop' => array('center', 'top'),
'post_format_icon_size' => 'normal',
'used_on' => array(
'Related articles'
)
)
);
And then in the theme panel for the thumbnails, “activate” the 200×150 size, and sadly YES, once again run “regenerate thumbnails” plugin (since there are no 200×150 thumbs).
So, now when you load the “related” images at bottom of your posts, they will be 200×150 “actual size” and not “resized” 238×00 images.
Not a hyper critical item, but for those trying to get that last dot of speed rating, this is one of the action items.
Hope these all help folks “dial it in.”
🙂
please, how I can translate the theme to the Portuguese newspaper? the number of his license is ce99d073-f037-4f52-9679-1b893346d4b1, fought
For those who want to set a custom time stamp under post titles, on post pages and in modules (it’s all or nothing unless you want to hack templates):
This fix survives theme updates as it’s a WordPress setting – not a theme setting.
https://forum.tagdiv.com/topic/tutorial-how-to-add-custom-time-stamp-to-posts/
-
This reply was modified 11 years by
simchris.
hi chris , thxs a lots
Its posible help to solve this
Specify a cache validator
What does this mean?
The following resources are missing a cache validator. Resources that do not specify a cache validator cannot be refreshed efficiently. Specify a Last-Modified or ETag header to enable cache validation for the following resources:
http://fonts.googleapis.com/css?family=Damion%7CArial&ver=4.1.1
http://fonts.googleapis.com/css?family=Open+Sans%3A300%2C400%2C600%2C700&subset=latin%2Ccyrillic-ext%2Cgreek-ext%2Cgreek%2Cvietnamese%2Clatin-ext%2Ccyrillic&ver=4.1.1
http://fonts.googleapis.com/css?family=Oswald%3A400%2C300%2C700&subset=latin%2Clatin-ext&ver=4.1.1
http://fonts.googleapis.com/css?family=PT+Sans%3A400%2C700%2C400italic&subset=latin%2Ccyrillic-ext%2Clatin-ext%2Ccyrillic&ver=4.1.1
http://fonts.googleapis.com/css?family=Roboto+Condensed%3A300italic%2C400italic%2C700italic%2C400%2C300%2C700&subset=latin%2Ccyrillic-ext%2Cgreek-ext%2Cgreek%2Cvietnamese%2Clatin-ext%2Ccyrillic&ver=4.1.1
http://fonts.googleapis.com/css?family=Ubuntu%3A300%2C400%2C500%2C700%2C300italic%2C400italic%2C500italic%2C700italic&subset=latin%2Ccyrillic-ext%2Cgreek-ext%2Cgreek%2Clatin-ext%2Ccyrillic&ver=4.1.1
http://fonts.googleapis.com/css?family=Vollkorn%3A400italic%2C700italic%2C400%2C700&ver=4.1.1
/wp-content/plugins/counterize/counterize.css.php
/wp-content/plugins/counterize/counterize.js.php
and this
Leverage browser caching
What does this mean?
The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:
plugins/counterize/counterize.js.php (1 hour)
and this
Add Expires headers
What does this mean?
There are 7 static components without a far-future expiration date.
http://fonts.googleapis.com/css?family=Damion%7CArial&ver=4.1.1
http://fonts.googleapis.com/css?family=Open+Sans%3A300%2C400%2C600%2C700&subset=latin%2Ccyrillic-ext%2Cgreek-ext%2Cgreek%2Cvietnamese%2Clatin-ext%2Ccyrillic&ver=4.1.1
http://fonts.googleapis.com/css?family=Ubuntu%3A300%2C400%2C500%2C700%2C300italic%2C400italic%2C500italic%2C700italic&subset=latin%2Ccyrillic-ext%2Cgreek-ext%2Cgreek%2Clatin-ext%2Ccyrillic&ver=4.1.1
http://fonts.googleapis.com/css?family=PT+Sans%3A400%2C700%2C400italic&subset=latin%2Ccyrillic-ext%2Clatin-ext%2Ccyrillic&ver=4.1.1
http://fonts.googleapis.com/css?family=Oswald%3A400%2C300%2C700&subset=latin%2Clatin-ext&ver=4.1.1
http://fonts.googleapis.com/css?family=Roboto+Condensed%3A300italic%2C400italic%2C700italic%2C400%2C300%2C700&subset=latin%2Ccyrillic-ext%2Cgreek-ext%2Cgreek%2Cvietnamese%2Clatin-ext%2Ccyrillic&ver=4.1.1
http://fonts.googleapis.com/css?family=Vollkorn%3A400italic%2C700italic%2C400%2C700&ver=4.1.1
thxs so much
Hi,
again; do *NOT* post questions here — post a NEW support topic for help with site optimization. This thread is for ME to post updated help on how to do this stuff.
@elteliblejvi
you cannot optimize anything being loaded from other sites than your own.
@fdiengdoh
me too! hate it (admin bar)! I used to add that, now I just uncheck the box in my “user” setting. That code is great when you have lots of users to make sure it’s not there. 🙂
Been too busy to add update here on how to optimize the Google fonts stuff. Will get to that eventually.
-
This reply was modified 11 years by
simchris.
Tired of the stupid “stoplight” from Yoast SEO in your admin pages …
add this to functions.php with my/your other enhancements…
add_filter( 'wpseo_use_page_analysis', '__return_false' );
(also note I am now testing setting the jpeg compression factor to 45 vs 50; since from time to time Google insights keeps saying .. you could save 45 bytes or some ridiculous tiny amount on thumbnails … “45” vs “50” might do the trick there …. )
For those specific folk using mod_pagsepeed
you may start seeing some oddities with Pagespeed Insights, where Google now telling you that stuff like a .js file or .webp file doesn’t have an expiration header over 5 minutes; where basically MPS is “intercepting” the file to serve on page build, and so a few oddities ignore the .htaccess file TTL settings (!).
The fix I discovered yesterday is adding a config line to the master pagespeed.conf file, and looks like this:
ModPagespeedImplicitCacheTtlMs 604800000
Basically this will over-ride the MPS default time to live (TTL) from 5 minutes to whatever time you want, such as a week. Note that the number is in msec not seconds (!). So, typically you need to work out that time using online converter (Google has built in function for that … !).
This was driving us nuts the other day, and this was the solution.
Depending on your server you might also need to actually add the webp MIME type to your apache mime setup file.
Hope that helped somebody!
Since this comes up a lot, I thought I’d list some of the plugins I use as standard fare on all our sites:
1) Thumbnail Upscale — this allows you to over-ride the stupid WordPress bult-in function to “disable” your servers natural capability with ImageMagik of “enlarging” your images to fit featured blocks/sliders.
2) Auto Post Thumbnail PRO — paid plugin which allows us to have some of our network content automatically pull from “first image in post” even if from our main hub, and make it the featured image. Awesome if converting to theme from OLD theme which used the TimThumb plugin.
3) WP-Optimize — awesome for regular optimization of dbase to clean house, on spam comments not deleted, trashed posts, and normal database clean up.
4) YOAST WordPress SEO — while we used to have an inhouse plugin for this, Yoast has done great job of putting it all together for managing meta data on global and per-post basis, setting up SEO for home page, and also OG tags for social media.
5) Awesome Weather Widget — we use this on our “state” and local news portals to add a nice local weather box to home page.
6) Limit Login Attempts — this should be built-in to WP, frankly. It helps stop people from sitting there and guessing user passwords or using a bot to hit it over and over. With IP blocking and tracking. Essential!!
7) WP External Links — in our case we need to make the majority of outbound links “rel=nofollow” and this does that automatically.
8) Auto-hyperlink URLs — we use this to control auto-linking of URLs in text, since we pull in a lot of content with visible but not anchor linked URLs in news text from our main hub. This makes all the links live, but also makes them rel=nofollow and open in blank/new window. Can also add external link icon if desired.
9) Simple Local Avatars — already noted in my optimization notes; this awesome little plugin allows you to load/cache GRAVATARS locally, as well as use local images for author pix, which will work on sidebar author blocks, author page, and in author box bottom of posts as it hooks into the main “author image” gravatar hooks; so anything which can read the normal WP gravatar image will work with this.
10) *lazy loading disqus” (not actual plugin name…) — we’re testing a recently launched plugin which uses Disqus API but loads element async and deferred and optimized to load after content and not slow down page. More later 🙂
Hope that helps somebody!!
Chris
First off, thanks so much Chris for putting all of this together – koodos to you and supporters alike for building up a community… and despite numerous attempts of asking people to stop asking questions in this sticky, some people simply cannot listen and let temptations lead to questions for the “drift” king himself.
Just to empathize with you, I spent about 3 days going over tons and tons of material pertaining to page speed, caching, functions.php, .htaccess, whatever I end up stumbling upon in hopes of getting that elusive high score .. Frankly, I wanted to blow my brains out (jokingly, not seriously I assure you).
I cannot fathom putting in the amount of work that you have for this sticky alone, and also in other threads. The pattern is clear, people will always turn to someone like you for the spoon fed answer they want. It’s mighty clear the way you’ve put it – I think you said somewhere in this forum that managing the website is purely the responsibility of the website owner, not tagDiv, not the community, it’s the owner’s responsibility. And I loved the buy a race car analogy.
.. well, anyways I think I’ve said what I wanted to, which is again koodos for everything you’ve done – truly truly great work. Same can be said for the rest of the supporters in this forum… I’m still new here, so give me another week and I’ll have nothing left to vent.
I did have something to contribute.. I found a resourceful YouTube vid about W3TC. Which I have started using.. Seems like a path many themers end up with.. It’s not spam, I assure you, the guy in the vid Craig Chamberlin gives an hour long tutorial about cache settings using W3TC. A for beginners, believe me when I say an hour of watching this guy is waaaaaaaayy better than trying to figure this sh#t out on your own in the wee hours of night.
https://www.youtube.com/watch?v=MYrsb8XnPtM
Cheers everyone!
@pslice
thanks for kind words 🙂
@bichareh
here is the one I’m playing with:
“Disqus Conditional Load”
https://wordpress.org/support/plugin/disqus-conditional-load
Have not had much time to mess with it since I’ve been updating 15 sites for all the various security issues, and auditing everything on case by case basis.
Fix for php overload issue …
On some sites with high traffic, large number of page views, large number of pages, online for years and years — you may see warnings on server of php going from “green to yellow” or “green to red” and in our case on ONE site this was happening in weird 5, 10, 20 minute intervals “on the nose.” The site gets pinged a LOT from news aggregators, Google News feeds, etc.
Finally figured out it was NOT home page complex layout, was NOT sidebars, was not anything related to ads (e.g., 3 ads per page vs 2), not related to Disqus or sharing buttons/widgets or Mashshare, etc.
Turned out to be the built-in “related” posts and more from author below each story. Disabling this immediately stopped the pummeling.
For this one website, we reverted to using “Contextual Related Posts” plugin, which we were using on this one site prior to Newsmag, so we knew it already would play nice. So, I now have that running and the plugin is setup to show 5 related posts as “text only” at bottom of each story (above the tag buttons). The plugin caches the most common searches to maintain juicy goodness and not overload the php query system.
This hasn’t been an issue on the other 5 sites, even when limited to only 3 items — but this ONE big site, it just was pushing things right to the “one more straw…” — hitting some CPU peaks of “10” vs normal of “1” or “2” (anything regularly over “4” means something funky going on ….).
So, right now with
(6) x NewsMag Sites
(2) x Newspaper Sites
(1) giant site not running WP
(6) sites running Woo
(2) sites running other (e.g., Udesign)
(10) misc apps, placeholder, ecommerce sites — not using WP
CPU
Last 1 minute 1.78
Last 5 minutes 1.55
Last 15 minutes 1.25
this morning it was running “hot” at “10” …
so, in case you need to “tune” a specific site for high spike-o-ramas, try disabling the “related” items bottom of your post page FIRST (!)
Addendum to my prior item above; this issue is actually resolved by using the TagDiv BETA “SHIM” which Radu has invented to deal with the PHP CPU issues related to Visual Composer. Expect info about this option at some point, possible in next update in June 2015; this likely will also be an option with Newspaper 5.
SOLUTION TO ISSUE OF WORDPRESS NOT GETTING ENOUGH MEMORY…
This assumes you have already increased the default memory allocated to php for your domain/hosting/site via normal hosting panel and/or php.ini to at least 128MB and likely 256MB ideal.
YOU SHOULD ALSO:
increase default php memory for WordPress in your wp-config.php file to 256MB. I’ve found, oddly, that for some reason, on some setups, changing the amount of memory via theme panel and php.ini does *not* actually increase amount of memory WordPress will actually use … adding the setting ALSO in config file makes difference. WordPress still thinks it will only use 40MB max by default, even if you have 256MB “allowed” on server — in our case, it doesn’t seem to SEE you CAN use up to 256MB unless you add the suggested line to your wp-config.php file.
*also note when dealing with memory settings to use “M” and not “MB” (!)
eg.
define( 'WP_MEMORY_LIMIT', '128M' );
https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP
Some additional optimizations for removing emoji code from WP 4.2x, removing the CSS for contact form 7 not used everywhere:
https://forum.tagdiv.com/topic/more-speed-improvements-sharing-for-functions-php/
CORRECTION TO BEST WAY TO SET CUSTOM TIME:
note I ran into issue with the previously suggested method for setting custom time stamp to print under headlines on posts, as it also changes the date used for things like archives by date pages and made the “day archive” post super funky — which came up when I put a calendar for month on one of my home pages.
So, better solution is:
I opened up single_template_2.php
and on/about line 30
added the time as so:
<?php echo $td_mod_single->get_date(false);?> <?php echo get_the_time(); ?>
Works perfectly.
Output on the post as (example):
By Terry Windall - May 5, 2015 12:47:18 -0400 EDT
for help on Linux ‘codes’ for setting date/time elements on WordPress admin panel and/or adding custom formats to above php code, see:
https://codex.wordpress.org/Formatting_Date_and_Time
HI, Glenn
doh. That just proves I’ve been too busy working on our main business website this past couple of weeks to even think about that or minifying my CSS, for that matter for 1.71.
I guess we might need Marius or Radu’s (et al) help on how to revise this code for the shim:
add_action('init', 'myoverride', 100);
function myoverride() {
remove_action('wp_head', array(visual_composer(), 'addMetaData'));
}
function dequeue_visual_composer_css() {
if (is_single()) {
wp_dequeue_style('js_composer_front');
}
}
add_action('wp_enqueue_scripts', 'dequeue_visual_composer_css', 1003);
since the new code in header is js_composer.css and old code is js_composer.css; not sure if we have to edit the booster main function file or what ?
This is totally a question for TagDiv support, so let us poke them on this one 🙂
Okay, direct from grand wizard Mr. Radu …. here is the code to hide the shim and VC on post pages for those of us who only use VC for home page or whatever and do NOT use it for posts! You don’t need to use *this* version unless you’re using the SHIM plugin to deal with CPU spikes with VC versions post 4.4 (for regular code for just hiding VC on posts, see the prior post ABOVE).
Here is updated from RADU June 5, 2015:
(and this goes in functions.php file in main root of theme folder, for those who did not already know that . . . )
function dequeue_visual_composer_css() {
if (is_single()) {
wp_dequeue_style('js_composer_front');
wp_dequeue_style('td-vc-composer-css-shim');
}
}
add_action('wp_enqueue_scripts', 'dequeue_visual_composer_css', 1003);
Hello from California 🙂
Hi folks … couple of fun ‘edge’ things to play with:
======================
CLOSURE COMPILER FOR JS
Google has started recommending a program (Closure Compiler) to manually minify js files which uses “latest methodologies” — but I’ve not yet tested this myself due to lack of time lately:
https://developers.google.com/speed/articles/compressing-javascript
==========
CRITICAL PATH GENERATOR FOR CSS
Something to consider using in place of TagDiv speed booster plugin for some instances/situations to remedy render blocking CSS issue — this basically inlines the “critical CSS” for your page, then you load the full CSS file at bottom of your page normally; so this allows the above the fold CSS to be part of initial doc load. Fascinating — it auto analyzes your existing web page then spits out optimized code you can place in the header file.
