Rolling a Linked List-style WordPress Blog
Note: this is a repost of the same topic from pxlnv.com, though I've changed it up a bit.
So you want to make a really hip linklog on your WordPress installation? And you want to make it super easy to post? I hear ya.
You'll need three things to start:
-
PHP Markdown (grab the "Extra" version for footnotes, tables, and other goodies)
- YJ Soon's excellent DFLL plugin, and
- My custom press-this.php file
The first thing on that list allows you to compose using Markdown, which is a hell of a lot nicer than both WordPress' visual editor, and building things with inline HTML (especially if you're updating your site from your smartphone).
The second thing on there is what actually creates the linked list-style post format. Follow Soon's instructions to set that up.
The third thing on there is a bit of magic. I replaced HTML quoting with Markdown quotes:
$selection = preg_replace('/(\r?\n|\r)/', "\n> ", $selection);
$selection = '> ' . str_replace('<p></p>', '', $selection) . '';
I don't write PHP, so this is a bit hacky, but it works well.
The other thing my file does is to build the post in the format required by YJ Soon's plugin:
$content = '';
if ( $url )
$content .= sprintf( "<a href='%s'>%s</a>.\n\n", esc_url( $url ), esc_html( $title ) );
if ( $selection ) {
$content .= $selection;
}
This puts the URL on the first line in an anchor tag, followed by a period.
Upload my press-this.php
to /wp-admin/
, after making a backup of that file. Drag the Press This bookmarklet to your bookmarks bar, and post happy. This works really well on everything from my smartphone to my laptop.
Notes:
- You'll need to replace the file every time you update WordPress.
To Do:
- Fix the above by pointing it to a different file (link-this.php, or something).
- Automatically parse inline links from quoted text.