Workflow for iOS – Publishing Linked Posts to WordPress

I bought Workflow for iOS [App Store] on the day it came out. The app was already amazing back then, but lacked a few features which could help me use it on a daily basis. The most recent update added WordPress support however. It took me a little over thirty minutes to put together a rough workflow for publishing linked posts on Infinite Diaries. I’ve been perfecting that workflow ever since and I’m finally ready to share it with the world.

I divided the workflow into sections, which I’ll explain below. You can find the download link at the bottom of the page. Please note that this workflow is specific to Infinite Diaries and you will have to modify it to work properly on your site (or modify the site itself, which is a bit foolish). Please also note that I’m running custom code to add external links to my posts’ titles both here and in the RSS feed.

‘Publish Linked Post’ Workflow

I run this workflow from Safari or Safari View Controller — it works fine in both. Since I usually post the author’s name as well as short quote from the linked article, I copy the text I want to use before running the workflow. I also add my own comment to the quote, but not every time.

Running the workflow on a specific page passes the URL to Workflow.app.

I use the Set Variable macro to save the URL to a variable first — wpURL in this case.

I then use the Get Details of Articles macro to pull the author of the post.

I change the author’s name and surname to lowercase and then capitalise it with title case, mostly to get rid of ALL CAPS and various other strange formatting occurrences.

The next step is an alert, which displays the author’s name. Since the macro from step 3 doesn’t always get it right, I use the dialog box to verify it was correctly retrieved.

I display a menu asking me if I would like to replace the author with a name input manually. If ‘no’ is selected, the macro continues. If ‘yes’, then a windows pops up asking to input the author.

The next steps are divided into Yes and No sections — only one of them is run depending on what is pressed in step 6. The ‘yes’ section asks the user for input and then adds a colon to the end of the author’s name, and then adds that data to the wpBody variable. The ‘no’ section just processes the author’s name again, and then adds it to wpBody.

This step takes the saved URL from the wpURL variable and inserts it into the URL macro.

This time I use the Get Details of Articles macro to pull the body of the post in.

A menu is displayed in this step, asking whether I want to use the clipboard (a quote saved from the article before running this workflow) as the quote, or if I would prefer to quote the whole article.

If ‘clipboard’ is chosen, then the Text macro adds the following HTML code to wpBody: (Clipboard variable) . If ‘full post’, then the following code is appended: (Input variable) . The latter means that the full body of the original post is added as a quote. I use this when I want to dissect someone’s complete article.

The next step uses the Nothing macro to split the workflow and make sure nothing unexpected is passed to the next action.

I then display a menu, asking if I want to add a comment to the quote.

If ‘yes’ is selected, then a dialog box is displayed with the ability to input text.

If ‘no’ is chosen, then nothing is executed.

I use the Nothing macro to split the workflow again.

The next step is to reload the wpURL variable…

… and use it to get the title of the article, again via the Get Details of Article macro.

I then save the original title under the wpTitle variable.

The next step is to run it through Brett Terpstra’s Title Case API, using the URL macro.

Brett’s API returns a result, which is retrieved by Get Contents of URL.

It is then saved to the wpTitle variable, overwriting it.

I ask for input again, to change the title if necessary.

I should probably add an if statement here to only re-run the title through the Title Case API if it’s changed. But I didn’t. The title is re-run through the API and saved under the wpTitle variable once more.

The last step of the workflow is to publish it to WordPress. Note: multiple WordPress sites can be added to the Post to WordPress macro.

I first get the wpBody via the Get Variable marco to push it through to the Post to WordPress macro.

I use the wpTitle variable to fill in the title field, change the post format type to Link, set the post’s status to Draft, add the Linked category to it (which I always use for linked posts) and ask to input the tags when the macro is run.

The last step is to add a Custom Field. I use LinkFormatURL in WordPress — the URL from that custom field will be placed as a link under the title of the post.

The whole thing is more complex than it should be, but it fits my workflow and needs almost perfectly. I did cut a few corners in one or two places, and I’ll probably correct that in the future.

In the meantime, feel free to download the workflow and adjust it to your own needs. Hopefully my explanation will make this easier to replicate for others. Also, feel free to ask me questions in the comments below.

★ Download my ‘Publish Linked Post’ workflow →