[wp-trac] [WordPress Trac] #5156: Ability to easily add tags to
posts using a list of existing tags...
WordPress Trac
wp-trac at lists.automattic.com
Sat Oct 6 18:22:59 GMT 2007
#5156: Ability to easily add tags to posts using a list of existing tags...
----------------------------+-----------------------------------------------
Reporter: andrewflanagan | Owner: anonymous
Type: enhancement | Status: new
Priority: normal | Milestone: 2.3.1
Component: Optimization | Version: 2.3
Severity: normal | Keywords: tags, javascript, add, ease of use
----------------------------+-----------------------------------------------
I love the new built-in tagging in 2.3. One of the things that I thought
would be helpful is to have a list of tags displayed for you so that you
can just click on them and add them to the list rather than always having
to type them. I make typos and I'm sure others do. At the same time, I
have at least a SOMEWHAT limited number of tags (under 100) so this
functionality seems useful.
Here's what I did to make this work on my site with Wordpress 2.3.
In the file wp-admin/edit-form-advanced.php, insert the following:
(between line 161 and 162)
==== begin code ====
<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;
?>
==== end code ====
I'm sure that this is sloppy but it works... I now get a list of tags that
I can click and automatically add to the tag list (and it inserts commas
as you'd expect). Anyway -- maybe this can be an option somewhere since
obviously it might be a bit much if you had a huge amount of tags.
--
Ticket URL: <http://trac.wordpress.org/ticket/5156>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list