Creates a dropdown list of non-hierarchical taxonomies as an alternative to the term (tag) cloud. Formerly known as Tag Dropdown Widget.
Since I first released this plugin in November 2009, WordPress introduced custom taxonomies and, as more-fully discussed below, saw a new widgets API overtake its predecessor. As part of the widgets-API-related rewrite, I expanded the plugin to support non-hierarchical custom taxonomies, which necessitated a new name for the plugin.
When I first wrote the Tag Dropdown Widget plugin (and it's sister Tag List Widget), WordPress was amidst a change in how widgets were managed. I decided to utilize the old widget methods to ensure the greatest compatibility at the time. In the nearly two years since I released version 1.0, the new widget system has been widely adopted, putting this plugin at a disadvantage. So, I rewrote the plugin to use the new widget API and added support for non-hierarchical taxonomies other than just post tags.
As discussed above, WordPress' widget system has changed drastically since I first released this plugin. To facilitate multiple uses of the same widget while allowing each to maintain its own set of options, the manner for storing widget options changed. As a result, there is no practical way to transition a widget's options from version 1.7 to 2.0.
Insert the function
<?php if( function_exists( 'taxonomy_dropdown_widget' ) ) echo taxonomy_dropdown_widget( $args, $id ); ?> where the dropdown should appear, specifying
$args as an array of arguments and, optionally,
$id as a string uniquely identifying this dropdown.
0to show full names. Defaults to
max_name_lengthsetting. Defaults to an ellipsis (
0for no limit. Defaults to
nameto order by term name or
countto order by the number of posts associated with the given term. Defaults to
ASCfor ascending order or
DESCfor descending order. Defaults to
0for now threshold. Defaults to
excludeto either include or exclude the terms whose IDs are included in
incexc_ids. By default, this restriction is not enabled.
falseto include in the dropdown any terms that haven't been assigned to any objects (i.e. unused tags). Defaults to
trueto include post counts after term names. Defaults to
Version 2.0 represents a complete rewrite of the original Tag Dropdown Widget plugin. As part of the rewrite, all prior functions for generating tag dropdowns were deprecated, or marked as obsolete, because they are unable to access the full complement of features introduced in version 2.0. While the functions still exist, their capabilities are extremely limited and they should now be replaced with
Term IDs can be obtained in a variety of ways. The easiest is to visit the taxonomy term editor (Post Tags, found under Posts, for example) and, while hovering over the term's name, looking at your browser's status bar. At the very end of the address shown in the status bar, the term ID will follow the text "tag_ID."
You can also obtain the term ID by clicking the edit link below any term's name in the Post Tags page. Next, look at your browser's address bar. At the very end of the address, the term ID will follow the text "tag_ID."
This plugin relies on WordPress'
get_terms() function (http://codex.wordpress.org/Function_Reference/get_terms). To modify the arguments passed to this function, use the
taxonomy_dropdown_widget_options filter to specify any of the arguments discussed in the Codex page for
To make targeting a specific filter reference possible should you use multiple instances of the dropdown (multiple widgets, use of the
taxonomy_dropdown_widget() function, or some combination thereof), the filter provides a second argument,
$id, that is either the numeric ID of the widget's instance or the string provided as the second argument to
Requires: 2.8 or higher
Compatible up to: 4.6
Last Updated: 3 weeks ago
Active Installs: 3,000+
0 of 2 support threads in the last two months have been marked resolved.
Got something to say? Need help?