Remove Gravatar images when looping ads
You might know it or not, but Gravatars on your Classipress site slow down loading of your site. The case here is that with default settings Classipress will load 30 posts on front page (10 for each tab) and each can have different Gravatar. This means 30 outside requests, which can be quite a nasty experience for customers. Of course, you can disable Gravatars in Classipress Settings, but then you won’t have them anywhere.
In this tutorial we will remove Gravatar images only when looping trough ads and showing them one below another. We will also show a nice small icon instead of Gravatar.
This modification was tested on WordPress 3.5.2 and Classipress 3.3 but should also work on newer versions of Classipress.
This tutorial requires you to change this file:
wp-content/themes/classipress/includes/theme-actions.css
It is recommended to make backup of this file before changing it.
Step 1
First you should download this default user icon: (right-click on it and choose Save)
But you can always use your own icon, just don’t forget to change the name of the file and dimensions on the line below.
Save it to your Classipress images folder (../classipress/images)
Step 2
Now open file theme-actions.php and change these values:
Find function cp_ad_loop_meta()
function cp_ad_loop_meta() { global $post, $cp_options; if ( is_singular( APP_POST_TYPE ) ) return; ?> |
<!--?php } </pre--> |
and change it to this:
function cp_ad_loop_meta() { global $post, $cp_options; if ( is_singular( APP_POST_TYPE ) ) return; ?> |
<!--?php } </pre--> |
Only the long line starting with is changed.
That's it. Your site should load faster now. You can try using Google's page speed checker or GTMetrix and see the difference before and after the change. |
If you find any issues with this tutorial, please be so kind and write a comment. I’ll try to help as much as I can.
If you find this tutorial useful, please consider making a small donation.
Bro, But where to place this “gravatar_mistery_man.png” You haven`t mentioned…
Put it to ../classipress/images folder. I have corrected the manual. Thanks.
Thank you so much bro…..