wp_category_checklist()
wp_category_checklist( int $post_id, int $descendants_a…
wp_category_checklist( int $post_id, int $descendants_and_self, int[] $selected_cats = false, int[] $popular_cats = false, Walker $walker = null, bool $checked_ontop = true )
输出用类别名称标记的复选框输入元素的无序列表。
Output an unordered list of checkbox input elements labeled with category names.
目录锚点:#说明#参数#源码#笔记
说明(Description)
另见函数 wp_terms_checklist()
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $post_id | (int) | 发布以生成类别检查表。默认值为0。$selected_cats不能是数组。默认值为0。 |
| $descendants_and_self | (int) | 要输出的类别及其后代的ID。默认值为0。 |
| $selected_cats | (int[]) | 要标记为选中的类别ID数组。 |
| $popular_cats | (int[]) | 接收“流行类别”类的类别ID数组。 |
| $walker | (Walker) | 用于生成输出的Walker对象。默认为Walker_Category_Checklist实例。 |
| $checked_ontop | (bool) | 是否将选中项移出层次结构并移到列表顶部。 |
源码(Source)
/**
* Output an unordered list of checkbox input elements labeled with category names.
*
* @since 2.5.1
*
* @see wp_terms_checklist()
*
* @param int $post_id Optional. Post to generate a categories checklist for. Default 0.
* $selected_cats must not be an array. Default 0.
* @param int $descendants_and_self Optional. ID of the category to output along with its descendants.
* Default 0.
* @param array $selected_cats Optional. List of categories to mark as checked. Default false.
* @param array $popular_cats Optional. List of categories to receive the "popular-category" class.
* Default false.
* @param object $walker Optional. Walker object to use to build the output.
* Default is a Walker_Category_Checklist instance.
* @param bool $checked_ontop Optional. Whether to move checked items out of the hierarchy and to
* the top of the list. Default true.
*/
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
wp_terms_checklist( $post_id, array(
'taxonomy' => 'category',
'descendants_and_self' => $descendants_and_self,
'selected_cats' => $selected_cats,
'popular_cats' => $popular_cats,
'walker' => $walker,
'checked_ontop' => $checked_ontop
) );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.5.1 | wp-admin/includes/template.php | 3 | 5 |
笔记(Notes)
基本示例
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!