Make adding a Podcast even easier

Quicktags are those useful 'one-click' buttons that insert code for you, and the default install has these;


But when you want to add a Podcast, you need to use a full url and typing that in repeatedly will get tedious.
But doing what is below will save you that hassle.
There is a link at the bottom of the page for you to download a default 'quicktags.js' that has had this change. In case you have modified yours, here is the code you need.

The file you need to edit is 'quicktags.js'
In version 2.0 this is in /wp-includes/js
In version 1.5.2 it is in the 'wp-admin' directory.

Download this using ftp to work on.
Do not just click on it to edit !
Right click, and open with a plaintext editor (Notepad, Wordpad, Notepad++, Crimson, BBedit etc)
Being able to see line numbers will help you.

You need to copy and paste the following 3 pieces of code into the file.
This part should be pasted at line 60 (after the 'Link' piece of code)
edButtons[edButtons.length] =
new edButton('ed_link2'
,'Podcast'
,''
,'</a>'
,'a'
); // special case

Paste this at line 188. It becomes the 3rd statement in the block of code that is there:
else if (button.id == 'ed_link2') {
document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink2(edCanvas, ' + i + ');" value="' + button.display + '" />');
}

And lastly, paste this section of code at line 406
function edInsertLink2(myField, i, defaultValue) {
if (!defaultValue) {
defaultValue = '';
}
if (!edCheckOpenTags(i)) {
var URL = prompt('Enter the Podcast name' ,defaultValue);
if (URL) {
edButtons[i].tagStart = '<a href="http://www.example.com/your/podcast/directory/' + URL + '">'; edInsertTag(myField, i);
}
}
else {
edInsertTag(myField, i);v }
}
There is a line in there which you need to edit.
Put the full URL to the directory where you will be storing your audio files.
If you are using a third-party facility, you could enter their URL there.
It MUST end with a /

That's the quicktag sorted. Now if you go to your Write screen - you may need to force a page reload (on Windows press CTRL and F5 together), you should see this:


Click the new quicktag to see this:


And once you have entered the name and clicked okay, this happens


Makes things easier!

You can download the file with the changes already made - quicktags
Right-click, select all, copy then save to your computer.
You will still need to edit the line that points to your podcast directory.

 

These pages are independent of http://wordpress.org
All design, content & images © Mark 2004-2008. All rights reserved.