This, I know, is the code a lot of people have been waiting for. It hasn’t been posted till now mostly because I’ve been trying to package everything to make it plug-and-play. At a certain point it was time to give up.
The code isn’t hard to grasp, but it will take some modification to get it to work.
The code is all on Github. Essentially it reads posts from WordPress via XMLRPC and creates InDesign Tagged Text files on a local drive.
I’ve written XMLRPC extenders for WordPress to go with this code. It is also on Github.
The XMLRPC extender simply allows us to query based on a lot more options and return a very full result. The real work is in the import script, and there you’ll have to do some modifications to make it work with your InDesign styles.
For us, this script is running on a server on our local network that everyone here has access to. We let it run every minute by setting up this simple cron job:
*/1 * * * * curl localhost/import.php
You’ll need a folder to store all the files in. By default it’s a directory called files. You’ll need to make sure that has the proper permissions to be written to.
By default all the stories will be saved in that folder named id.txt. We use this to programmatically pull the stories into InDesign, but that plugin isn’t released yet. You might want to consider naming the files using the story title to make it more easily human readable.
The templating process isn’t quite as easy as WordPress’, but if you’re familiar at all with styles and PHP you should be able to figure things out. The code is pretty well documented, I think, but if you have questions please leave them as a comment on this post and I will do my best to respond to all of them.