6 years ago (2015-01-31)  Algorithm language |   First to comment  6 
post score 0 times, average 0.0

Since the blog post, I have changed a lot of themes, and finally decided to use the thetinection themes for the creation of the words. This is a wordpress theme that I personally think is very good, but its disadvantages are also obvious: the speed is too slow, because the theme of the theme There are too many css and js files loaded in the code, resulting in a large number of requests to the server. Fortunately, the update of the theme is faster, and we hope to streamline the code and reduce the number of file requests in future updates. In addition to the above drawbacks, there is a problem with tinection: it consumes too much traffic.The theme of the author's previous thoughts used to spend only 1 G traffic in the next month when he or she just debugged the visit. The current theme of the trial is to spend nearly 300 million a day, and the frequency of visits to the website has not been used before. More often than not.For individual users, everyone generally uses a virtual host, and the monthly traffic provided by space providers is often limited. Even if you use CDN acceleration, this “fuel consumption” based on the theme of “tine” is not enough. Therefore, the author thinks that A bit of code for the topic, to introduce to you a practical wordpress how to save traffic using wording theme.

Reduce the number of random thumbnails

Tinection's article lists and related lists all randomly assigned thumbnails for non-graphics articles. However, it is very "fancy" that all randomized pictures have as many as 40. In fact, due to randomly assigned pictures, reducing the number of pictures does not save traffic. , but for most bloggers that use "static file caching", too many random pictures will make it hard for visitors to bump into the same file that was previously cached.Therefore, reducing thumbnails to increase the cache file hit probability is a feasible method for saving traffic.

specific method:

Find the functions.php in the theme folder themestinection and search for "$random = mt_rand". This is a function that generates a random number. You can set it to the number of pictures you want. For example, the author only wants to use 15 pieces:

This theme only calls the "1~15.jpg" picture under the "tinectionimagesrandom" of the random theme folder for the story theme.

Recommended: Reduce thumbnail quality to reduce traffic

The author found through the “examination element” that the theme thumbnails of the theme were oversized, and it was extremely ridiculous that some thumbnail images were even larger than the original images.One of the original pictures 54K, after the abbreviated even reached 102K!For the heavily used theme topics, it will consume too much unnecessary traffic.After modifying the code, the author reduced the size of this picture to 14K, and the picture quality has little effect.

specific method:

Find the functions.php in theme folder themestinection, search for "function tin_thumb_source" and change the contents of the function to:

Among them, the author set the thumbnail quality of the mobile device to 20, and the other devices to 80, which we can modify according to our own needs.It is also worth pointing out that, after my practice, the thumbnail function of this topic has a very poor effect on the png format picture, and even increases the size of the original picture. It is recommended that you insert the jpg format picture when you write the article.


Unless otherwise specified, all articles on this site are original Baiyuan's Blog, in order to respect the author’s Labor results, please indicate the source https://wangbaiyuan.cn/en/tinection-themes-wordpress-how-to-save-traffic-2.html

Post comment


No Comment


Forget password?