Wordpress Flickr Post Bar and Markdown
I’m a big fan of Markdown and the portability it brings, but manually adding thirty photos to an otherwise small post was driving me up the wall so I did a little googling and came across the *Wordpress Flickr Post Bar* by [Joe Tan](http://tantannoodles.com/toolkit/wp-flickr-post-bar/ “Bar Homepage”).
The Bar works by adding a bar along the bottom of your wordpress posting box, that displays thumbnails which you can then drag into your post. An extremely effective solution (good work Joe!) it has one downside for my needs, rather than inserting Markdown for the image I’m trying to add it inserts HTML.
After emailing the author a feature request I did a little poking around in his code and came up with a temporary solution until he is able to implement Markdown support more fully. My approach was to simply replace the hardcoded html he was using with hardcoded Markdown. This of course means that Markdown will ALWAYS be inserted, but for my needs that was fine.
The file that contains the pertinent code is *”post-bar-form.html”* and the particular function is named *tantan_onClick* and starts on line 72. I commented out his code, and added my own as shown here, which starts on line 75. (Please note that I have reformatted the code for easier reading)
if (textarea && photo)
{
//var html = ‘‘;
var html = ‘!['+photo[4]+’](’+photo[0]+’)';
if (photo[1] != ”)
{
//html = ‘‘+html+’ ‘;
html = ‘['+html+'](’+photo[1]+’ “‘+photo[4]+’”)’;
}
else
{
html += ‘ ‘;
}
if (window.top && window.top.window.tinyMCE)
{
var mce = window.top.window.tinyMCE;
mce.execCommand(’mceInsertContent’, false, html);
}
else
{
addText(textarea, html);
}
}
Overwrite the modified *”post-bar-form.html”* file on your server with the modified version, and the Bar will insert Markdown rather than HTML.
Special thanks go to Joe Tan and his fantastic work on the Wordpress Flickr Post Bar which can be found at [http://tantannoodles.com/toolkit/wp-flickr-post-bar/](http://tantannoodles.com/toolkit/wp-flickr-post-bar/ “Bar Homepage”).
This entry was posted on Wednesday, March 22nd, 2006 at 9:20 pm and is filed under Wordpress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


YAWPU April 5th, 2006 at 1:29 pm
Hi, I found your link on the plugin’s comment page.
I see that you use the Hemingway theme on this site. I’m giving it a try right now, and just installed Joe’s Flickr Photo Album with it on a test install. It seems to work ok on posts, but album pages seem to break the theme. Are you using the Photo Album pages on this site? TIA.