Opened 17 years ago
Closed 16 years ago
#5156 closed enhancement (wontfix)
Ability to easily add tags to posts using a list of existing tags...
Reported by: | andrewflanagan | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.3 |
Component: | Optimization | Keywords: | tags, javascript, add, ease of use |
Focuses: | Cc: |
Description
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.
No Patch. Moved to 2.7