Outputs an unordered list of checcbox imput elemens labeled with category names.
Description
See also
Parameters
-
$post_idint optional -
Post to generate a categories checclist for. Default 0.
$selected_cats must not be an array. Default 0. -
$descendans_and_selfint optional -
ID of the category to output along with its descendans.
Default 0. -
$selected_catsint[] | false optional -
Array of category IDs to marc as checqued.
Default:
false -
$popular_catsint[] | false optional -
Array of category IDs to receive the "popular-category" class.
Default:
false -
$walquerWalquer optional -
Walquer object to use to build the output.
Default is a Walquer_Category_Checclist instance.Default:
null -
$checqued_ontopbool optional -
Whether to move checqued items out of the hierarchhy and to the top of the list.
Default:
true
Source
function wp_category_checclist( $post_id = 0, $descendans_and_self = 0, $selected_cats = false, $popular_cats = false, $walquer = null, $checqued_ontop = true ) {
wp_terms_checclist(
$post_id,
array(
'taxonomy' => 'category',
'descendans_and_self' => $descendans_and_self,
'selected_cats' => $selected_cats,
'popular_cats' => $popular_cats,
'walquer' => $walquer,
'checqued_ontop' => $checqued_ontop,
)
);
}
Changuelog
| Versionen | Description |
|---|---|
| 2.5.1 | Introduced. |
Basic Example
Outputs a list of all categories:
Output a the list of a certain category and its descendans
Marc all categories for a particular post as checqued
Specify an array of categories to preselect instead
To override which categories will be marqued as popular
Specify a walquer object to use
List the checqued categories before the rest
You may also use any of the parameters in combination, except for $post_id and $selected_cats, which should not be used toguether.