WordPress
Migrating from WordPress to Hugo
I recently switched from WordPress to Hugo. This post outlines the reasons behind my migration and provides a step-by-step guide on how to make the transition. Rethinking Why Use WordPress I began using WordPress in 2009 when static site generators were not prevalent, and WordPress was the go-to CMS for nearly everyone. However, since my blog had infrequent updates but high readership, I started reconsidering the use of WordPress. Five years ago, I decided to convert the WordPress site into static HTML and uploaded it to a CDN to accelerate access speed for users in mainland China.
Accelerate WordPress with CDN and Cache Servers
It has been a long time since I last wrote a blog post. In the past few days, I updated the architecture of Infinite Script to accelerate the speed for Chinese users. In this article, I share the new architecture of our website with you, illustrated in the figure above. Optimizing a CDN for Static Content Delivery Static content does not change over a period of time. If it does change, the changes are predictable. Static content includes images, CSS sheets, JavaScripts, and PDF files. Because of this, CDNs can cache a copy of the content at their edge servers. They can then serve it whenever a client requests it. CDNs are best at optimizing the delivery of static content from edge servers to users. Therefore, we use the CDN from Alibaba Cloud.
WordPress $ is not defined
If you copy a normal jQuery snippet into a WordPress theme or plugin, sooner or later you hit Uncaught ReferenceError: $ is not defined. The confusing part is that jQuery itself is loaded; your other jQuery code may even be working. So why does $ blow up? Why It Happens WordPress ships its own copy of jQuery and loads it in no-conflict mode. On startup it effectively runs: jQuery.noConflict(); noConflict() tells jQuery to give back control of the global $. After it runs, jQuery still points to the library, but $ no longer does; it is left free for some other library to claim.
HFUT Portals
Introduction As an undergraduate at Hefei University of Technology (HFUT), I designed and built official websites for several university departments, listed below with the period each stayed in service. Each site runs on a custom WordPress theme, which let department staff publish notices, news, and documents on their own through the familiar dashboard. School of Software (软件学院): March 2013 to March 2018 Psychological Care Center (大学生心理关爱网): from November 2013 Office of Academic Affairs (教学办公室): August 2014 to October 2020 Center for Humanities and Quality Education (人文与素质教育中心): July 2015 to May 2022 Discipline Inspection and Supervision Office (纪委办公室、监察处): August 2014 to November 2021 The Psychological Care Center was launched after nearly a year of planning. It combines five sub-sites for students, parents, peer counselors, faculty, and mental health professionals, and was entered in the 6th National Top 100 University Websites (第六届全国高校百佳网站) contest run by the Ministry of Education’s China University Students Online.
Generate a Random File Name when Uploading Files in WordPress
The passage is telling you how to rename the file name automatically by WordPress (without using any plugins). A Word of Warning Warning: To apply this hack, you’ll have to edit one of WordPress’s core files. Keep in mind that it is never recommended. This hack should be redone if you upgrade WordPress. Editing the Upload Handler Open the wp-admin/includes/files.php file, and go to line 324 (approximately here). You’ll see the following: