Zum Inhalt springen

Archiv für "Kirby"

Syndicate some Blogposts from WordPress to Kirby with the REST API - Revisited

One year ago I established a connection between some blog posts here to my portal site via the WordPress REST API, a cron job, and some php-scripts.

This weekend I revisited the code, since there was one detail that kind of bugged me: The REST API treats "categories" as an OR condition; but for my use case I wanted an AND condition. I only want to show posts that have a combination of categories, like "english" AND "webdesign", but the API returns all posts having one of the two categories.

I have updated my portal site to the new Kirby 3 version recently, and that needed little tweaks here and there, and so I had a look at the blog teasers code. After reading the WordPress REST API documentation (again), I think there is no way to get this AND condition I wanted, so I had to refactor the code on the other end.

Syndicate some Blogposts from WordPress to Kirby with the REST API

New year, old problems, new Website -- this was my reasoning during the christmas holidays, and so I decided to completly wipe my "About me" website, making it a simple hub of my diverse activities and interests instead of the old "hey, look how cool experienced I am, come work with me and give me all your money" thing.
I decided to build the site with Kirby, a lovely file based CMS which I have used in the past (for example to drive our Frankfurt Open Device Lab website). Kirby is very flexible, has a stellar documentation, a nice API, and makes zero assumptions on how you want to build your site, and besides being file based, it offers a very customizable backend, if need be.

Now, one of the things I wanted on the new site was a way to display the latest posts from here, my blog, but only those relating to the topics of Design, Webdevelopment and the like.

With a little bit of diving into the WordPress REST API, this turned out to be a fairly simple task for my Kirby-site. Basically this REST API allows me to "get" the infos needed on various objects of my WordPress site, by calling the API's entry points and telling it what I want.