banner
Feng

Feng's xLog

我在xLog上的窝

Headless WordPress Exploration记

What is Headless WordPress?
Headless WordPress is a term that refers to any website that uses WordPress as the backend software to manage data and content, but uses separate technology to display data on the frontend. The backend is the term used for the website management area. You can create content such as posts and pages here, install plugins, manage comments, etc.

image

I saw something about Headless WordPress on the "I Love Boiled Fish" website (link) a long time ago, and it seemed interesting, but I never got around to trying it out. It is said that this is implemented purely with PHP + Memcached. Recently, for some reason, I have been looking at Hugo and this Headless WordPress. I haven't figured out the former yet, following the steps of the blank big shots, I haven't figured it out yet. I remember when I used to work with Hugo or Hexo, I had to set up the environment locally, write articles, generate them, and then PUSH them to the site (Github or VPS, etc.). But now, you can directly throw the source file MD to Github Action to generate and PUSH to the site (it may also be that I misunderstood, anyway, I didn't get it right). Going off track, since I haven't figured out Hugo, let's work on Headless WordPress, and when I have a clue, I'll go back to Hugo. This time, I worked on Headless WordPress with the help of ChatGpt4. Almost all the code was written by it, and I just copied and modified it, because I'm an old white guy (my definition of an old white guy is: a little better than a newbie, but not an expert, etc.). I can successfully call Html and PHP, among which the Html version is distributed (pagination or previous and next pages are normal), but Html cannot be cached with Memcached (at least that's what ChatGpt said, because Html itself is a static file), if you use PHP to do it, after adding Memcached, the pagination function has not been figured out and needs further research.

image

However, whether it's Html or PHP, the current calls are all working fine, the homepage or article page can be displayed normally (forget about beautification, just added some adaptive and a little CSS decoration). If I have time in the future, I'll tinker with it, or I might just stop here, because I love tinkering. Besides tinkering with this, I've been tinkering with xLog early on, which is a supposedly open-source creative community written on the blockchain (introduction here). Of course, there is also my blockchain blog address: blog.057000.xyz, all of which have been moved over, so if you're interested, you can go register.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.