WordPress InDesign Porky

Well, that may be a very harsh headline, but please bear with me. I am going to explain that in a second or two.

One of my current project involves Adobe InDesign, a tool I am using since 2010 when I started designing the student newspaper “HG Times” at my former high school. Since then, a lot of software versions passed by. Now, with the newer versions it got more versatile when it comes to creative tasks. And thanks to so many improvements on the core of the tool, you can start developing your own scripts and plugins.

These plugins may be used to do simple tasks like remove double spaces in any given text or you may use another more complex one to get some contents from a website into a given layout. That one is what I wanted to cover today. And in fact – we will be using a WordPress-based website.

To glue both of the tools together, I developed my own WordPress-Plugin-based export solution. But for the project I am talking about today, I decided to take another path using Porky from the Schreiber and Freunde agency based in Neckarsulm, Germany.
Heike Burch asked me when I gave my talk at the PUBKON 2015 if it was possible to realize a cookbook with WordPress. I said that there surely was a plugin for that – which in fact was true: There is the WP Ultimate Recipe plugin.
Soon enough, Heike installed it on her WordPress website fuer-freunde.ch.

We were talking about the workflow, which Heike used before we started working on it. She was using an Excel file, which then was exported to a CSV file. That one could be used for the InDesign Data Merge generating multiple ready-to-print PDF files.
She printed those files and offered them in her online shop.

Our first step was to get the recipes off of the Excel file into the WordPress setup. Therefore, I wrote a small migration script – 91 lines using the PHPExcel library.
Another plugin I wrote to give Heike something to work with was the plugin to enumerate her recipes manually. I wrote a plugin, this time 167 lines of code, which made the recipes search- and sortable by the custom enumeration.
We uploaded the images Heike already took for some of her recipes and another script was used to let WordPress know about the images and link them correctly to the recipes. It wasn’t a plugin, but a maintenance script, which was called subsequently to add the images and generate the thumbnails for them.

With those plugins activated, one could be satisfied if it was only a website. But we were going for more.

As I mentioned before, I was heading to Porky to solve the problem. Porky, as you may take it from the name, could easily be taken for “pork”, the logo shows a stylized porky. And we need the porky alive, which is why we can live with it as a vegetarian. It sounds okay in my head, so I guess you will have to accept that. 🙂

Porky basically allows developers to connect InDesign and other ExtendScript-enabled tools to use external data sources like databases, XML or JSON files. And even more interesting is the fact, that we do not need to download the files and store them locally, but we can fetch them directly from the web, Porky acts as a proxy and flattens the required steps to get the data from the source. Therefore I developed another WordPress plugin, which enables a JSON API to get the information about the recipes in a structured way. On the other hand, I was developing an InDesign script, which uses Porky to request the data from the WordPress website and put it in a structured way into the layout.

If we put it simple, the workflow stays the same as with the Data Merge, but you are clicking somewhere else now.

If you are interested in a German presentation of this project, you may come and visit the next IDUG Berlin. You may sign up for their newsletter and get informed about upcoming dates and invitations.

Are you looking for a custom Web-to-Print solution? Did you ever wonder how to solve a particular problem in WordPress or InDesign? Let’s talk about it in the comments below!