5Oct/070
WordPress Tagging
I just upgraded to WordPress 2.3 which supports tagging natively. There's a new spot under the Edit window where you can enter tags. I'm lazy though so I'd like it if it could present me with a list of my tags so I could click and add them automatically... I just modified the code a little bit for one file in WordPress and it appears to work... here's what I did.
In the file wp-admin/edit-form-advanced.php, insert the following:
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | <script type="text/javascript">
function setTag(text)
{
var curvalue = document.getElementById('tags-input').value;
if (curvalue == "")
{
document.getElementById('tags-input').value = text;
}
else
{
document.getElementById('tags-input').value = curvalue + ", " + text;
}
}
</script>
<?php
$output = "<legend>";
$tags = (array) get_terms('post_tag', $args);
foreach ($tags as $tag)
{
$output .= "<a href=\"#\" onClick=\"setTag('".$tag->name."')\">".$tag->name."</a>,";
}
$output = substr($output, 0, strlen($output) - 1);
$output .= "</legend>";
echo $output;
?> |
Tagged as: organization, php, scripts, wordpress
Leave a comment
Twitter Updates
Location
StackOverflow
Reading...
- New hymn by Douglas Bond: Creator God, Our Sovereign Lord, 2007 (andrewzle's YouTube Activity)
- I'm not on Facebook (TYWKIWDBI ("Tai-Wiki-Widbee"))
- Business Ideas (Dilbert.com Blog)
- Safe Passage (Futility Closet)
- Unquote (Futility Closet)
Identity
Links
Projects
Web Apps
Tags
apple
audio
bash
beauty
christianity
church
computer
design
development
easter eggs
economics
electrical
email
financial
fun
gentoo
google
grammar
hobbies
humor
ideas
investments
language
linux
musings
network
open-source
organization
people
php
politics
programming
Projects
rants
scripts
security
sin
software
stupidity
technology
theology
windows
wordpress
work
writing