DFLL plugin update: now supports “Press This”

### The Boring Backstory

On Tuesday, I read about Justin Blanton’s [Slugger+](http://hypertext.net/projects/sluggerplus) WordPress plugin, which allows you to set your [post slug](http://wordpress.org/tags/post-slug) by entering your desired slug enclosed in `[slug]` tags, e.g. `[slug]this-is-my-slug[/slug]`. I wondered if I could adapt my [Daring Fireball Linked List plugin](http://yjsoon.com/dfll-plugin) to do the same, i.e. if someone entered, `[dfll]http://yjsoon.com[/dfll]` somewhere in their post, the plugin could find the URL and set the custom field link to it.

So I tried implementing this, and I was stalled when I [ran into a problem](http://wordpress.org/support/topic/adding-a-custom-field-from-content_save_pre-filter-through-xmlrpc?replies=2). Apart from posting it on the WP forums, I emailed Justin to see if he had any ideas. Coincidentally, he had been working on the same feature, and he’d also run into the same problem! I went off for work, and a few hours later, Justin emailed to say he’d solved the problem, and he released his [CF Setter](http://hypertext.net/projects/cfsetter) plugin the next day.

After CF Setter was released, I decided not to replicate its functionality in my plugin. (If you’d like to use that feature, go take a look — you just need some minor adjustments to get it to work with my plugin.) Instead, I thought I’d try and adapt Justin’s code to solve another problem: posting using WordPress’s built-in “[Press This](http://codex.wordpress.org/Press_This)” bookmarklet. [Shawn Blanc](http://shawnblanc.net/2009/08/wp-linked-list-plugin/) had put up a customised version of the bookmarklet’s code a while ago, but I was never comfortable with editing core files, what with automatic upgrades and all.

### New Coolness: Link from Post Content

So, long story long, a few hours and a lot of painful regular expression writing later, the [new DFLL plugin](http://yjsoon.com/dfll-plugin) supports “Press This” by extracting the link from the first anchor tag in the post content.

Here’s how you use it: First, turn on the setting in the options page. Next, on any page you’d like to link to, just click the “Press This” bookmarklet, and the following will pop up:

Screen shot 2011 03 31 at PM 08 15 13

Click on the end of the first line, press enter (_be careful not to delete the period!_), and type whatever comments you’d like. The plugin will automatically __grab the URL in the first line__, __set it to the linked\_list\_url custom field__, and __delete the entire first line__ for you, preserving whatever you’ve entered into the rest of the post content. Ta-da! Linked list item!

If you’d like to use this with the [MarsEdit](http://www.red-sweater.com/marsedit/) bookmarklet, you can customise the Attribution preference as follows:

Screen shot 2011 03 31 at PM 08 25 09

More details are on the [DFLL plugin](http://yjsoon.com/dfll-plugin) page, which I’ve linked to thrice already in this post. Many thanks to Justin Blanton for his plugins which both inspired and laid the foundations for this feature.

Questions and comments? Look for me on [Twitter](http://twitter.com/yjsoon) or through the [contact form](http://yjsoon.com/contact).