IT Blog

  • Blog
  • Technology
    • Architecture
    • CMS
    • CRM
    • Web
    • DotNET
    • Python
    • Database
    • BI
    • Program Language
  • Users
    • Login
    • Register
    • Forgot Password?
  • ENEN
    • ENEN
Experience IT
In a World of Technology, People Make the Difference.
  1. 首页
  2. Technology
  3. CMS
  4. Wordpress
  5. 正文

How to do some trick to improve WordPress performance

2020年12月29日 75点热度 1人点赞 1条评论
Loading...

There are many ways to improve WordPress performance. But here I would introduce a trick to dramatically improve the page loading speed.

Convert to html page

As a web page the ultimate content is html code. If we could response in html directly without bothering the server code and database to run the page would be loaded really quick.

  1. make sure the web page working as expected
  2. use browser developer tool to view the sourceHow to do some trick to improve WordPress performance
  3. copy the html source codeHow to do some trick to improve WordPress performance
  4. go to File Manager of the CPanel, manually create folders and index.html file according to the url pathFor example: for url "https://hostlike.com/zh/web-hosting/"create folder /zh/web-hosting/, then create file index.html under the new folderHow to do some trick to improve WordPress performance
  5. open index.html with file editor
  6. paste the copied content to the index.html file
  7. save the content.

Dynamic content trick

If there is dynamic content, e.g. shopping cart item number. We can use JavaScript to update the value.

How to do some trick to improve WordPress performance

Add the following JavaScript code to the end of index.html content.

function getCookie(name) {
    const value = `; ${document.cookie}`;
    const parts = value.split(`; ${name}=`);
    if (parts.length === 2) return parts.pop().split(';').shift();
}
var cart_count = getCookie('woocommerce_items_in_cart');
$('.wcmenucart-details').text(cart_count);
IT Team
Author: IT Team

Loading...
标签: 暂无
最后更新:2020年12月29日

IT Team

stay absorbed stay excellent

点赞
< 上一篇
下一篇 >

文章评论

  • Albert

    This approach will change dynamic content into static, therefore, it is not for every situation. It is good for those pages witch contents are not changed often.

    2021年01月12日
    回复
  • 取消回复
    最新 热点 随机
    最新 热点 随机
    Generating Test Data with SQL Scripts Remote connection to MySQL on SiteGround Hide author information from WordPress How to do some trick to improve WordPress performance Recovering user role in WordPress Sending email using gmail SMTP
    How to do some trick to improve WordPress performanceRemote connection to MySQL on SiteGroundGenerating Test Data with SQL ScriptsRecovering user role in WordPressHide author information from WordPress
    Mixed Content warning: request an insecure element was automatically upgraded to HTTPS How to auto-move to the bottom of a block Controlling sidebar hide/show on post Adding Featured Image for Envira Gallery posts in batch Converting asp.net website to wordpress Product Catalogue plugin issue fixes
    Categories
    • AdSense
    • Architecture
    • BI
    • C#
    • CSS
    • Database
    • Digital Marketing
    • DotNET
    • Hosting
    • HTML
    • JavaScript
    • PHP
    • Program Language
    • Python
    • Security
    • SEO
    • Technology
    • Web
    • Wordpress

    COPYRIGHT © 20203-2021 Hostlike.com. ALL RIGHTS RESERVED.