Creates lists of non-hierarchical taxonomies (such as
post tags) as an alternative to term (tag) clouds. Multiple widgets can be used, each with its own set of options.
Numerous formatting options are provided, including maximum numbers of terms, term order, truncating of term names, and more. List styles are fully customizable, with built-in support for bulleted lists and numbered lists.
taxonomy_list_widget function, users can generate lists for use outside of the included widget.
Only use version 1.2 or higher with WordPress 4.2 and later releases. WordPress 4.2 changed how taxonomy information is stored in the database, which directly impacts this plugin’s include/exclude term functionality.
This plugin was formerly known as the
Tag List Widget. It was completely rewritten for version 1.0.
- Upload taxonomy-list-widget.php to /wp-content/plugins/.
- Activate plugin through the WordPress Plugins menu.
- Activate widget from the Appearance > Widgets menu in WordPress.
- Set display options from the widget’s administration panel.
What happened to the Tag List Widget plugin?
Since I first wrote the Tag Dropdown Widget plugin upon which this plugin is based (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.
Why did you rewrite the plugin?
When I first wrote the Tag Dropdown Widget plugin, which I later forked to create the Tag List Widget plugin, 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 the first version of this plugin, 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.
I upgraded to version 1.0 and all of my widgets disappeared. What happened?
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 0.3.1 to 1.0.
Insert the function
<?php if( function_exists( 'taxonomy_list_widget' ) ) echo taxonomy_list_widget( $args, $id ); ?>where the list should appear, specifying
$argsas an array of arguments and, optionally,
$idas a string uniquely identifying this list.
- taxonomy – slug of taxonomy for list. Defaults to
- select_name – name of first (default) option in the list. Defaults to
- max_name_length – integer representing maximum length of term name to display. Set to
0to show full names. Defaults to
- cutoff – string indicating that a term name has been cutoff based on the
max_name_lengthsetting. Defaults to an ellipsis (
- limit – integer specifying maximum number of terms to retrieve. Set to
0for no limit. Defaults to
- orderby – either
nameto order by term name or
countto order by the number of posts associated with the given term. Defaults to
- order – either
ASCfor ascending order or
DESCfor descending order. Defaults to
- threshold – integer specifying the minimum number of posts to which a term must be assigned to be included in the list. Set to
0for now threshold. Defaults to
- incexc –
excludeto either include or exclude the terms whose IDs are included in
incexc_ids. By default, this restriction is not enabled.
- incexc_ids – comma-separated list of term IDs to either include or exclude based on the
- hide_empty – set to
falseto include in the list any terms that haven’t been assigned to any objects (i.e. unused tags). Defaults to
- post_counts – set to
trueto include post counts after term names. Defaults to
- delimiter – sets list style. Native options are
nlfor bulleted list, numbered list, and line breaks, respectively. By passing an array with keys
after_item, you can completely customize the list style.
- rel – either
nofollow. Can still use
taxonomy_list_widget_link_relfilter to specify link relationship.
- taxonomy – slug of taxonomy for list. Defaults to
Why is the TLW_direct() function deprecated?
Version 1.0 represents a complete rewrite of the original Tag List Widget plugin. As part of the rewrite, all prior functions for generating tag lists were deprecated, or marked as obsolete, because they are unable to access the full complement of features introduced in version 1.0. While the functions still exist, their capabilities are extremely limited and they should not be replaced with
Where do I obtain a term’s ID for use with the inclusion or exclusion options?
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_termsfunction (https://codex.wordpress.org/Function_Reference/get_terms). To modify the arguments passed to this function, use the
taxonomy_list_widget_optionsfilter 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 list (multiple widgets, use of the
taxonomy_list_widgetfunction, 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
Contributors & Developers
“Taxonomy List Widget” adalah perisian sumber terbuka. Orang-orang berikut telah menyumbang kepada pemalam ini.Penyumbang
Berminat dalam pembangunan?
- Fix translation support.
- PHP 7.3 compatibility
- Update for WordPress 4.3 by removing PHP4-style widget constructor usage (https://make.wordpress.org/core/2015/07/02/deprecating-php4-style-constructors-in-wordpress-4-3/).
- Update for WordPress 4.2 to handle term splitting in the plugin’s include/exclude functionality. Details at https://make.wordpress.org/core/2015/02/16/taxonomy-term-splitting-in-4-2-a-developer-guide/.
- Correct problem in WordPress 3.3 and higher that resulted in an empty taxonomy dropdown.
- Remove all uses of PHP short tags.
- Allow empty title in widget options. If empty, the
taxonomy_list_widget_titlefilter isn’t run.
- Provide control over link relationship (
nofollow) in widget. This capability is still available via the
- Fix fatal error in older WordPress versions resulting from PHP4 and PHP5 constructors existing in widget class.
- Fix bug in post count threshold that resulted in no terms being listed.
- Fix fatal error
- Completely rewritten plugin to use WordPress’ newer Widgets API.
- Drop support for WordPress 2.7 and earlier.
- Add support for all public, non-hierarchical custom taxonomies, in addition to Post Tags.
- Introduce new, more flexible function for manually generating lists.
- Fixed persistent bugs in the include/exclude functionality.
- Widget admin is translation-ready.
- Replace id on list items with class.
- Reduced variables stored in database to two.
- Added function