WordPress 开发 wp_category_checklist 将分类显示为checkbox格式

WordPress 开发 wp_dropdown_categories 下拉式框显示所分类目录标签函数

wp_category_checklist( int?$post_id, int?$descendants_and_self, array?$selected_cats?=?false, array?$popular_cats?=?false, object?$walker?=?null, bool?$checked_ontop?=?true?)

Output an unordered list of checkbox input elements labeled with category names.输出一个没有排序的checkbox格式的分类。

Parameters

$post_id

(int) (Optional) Post to generate a categories checklist for. Default 0. $selected_cats must not be an array. Default 0.

$descendants_and_self

(int) (Optional) ID of the category to output along with its descendants. Default 0.

$selected_cats

(array) (Optional) List of categories to mark as checked.

Default value: false

$popular_cats

(array) (Optional) List of categories to receive the “popular-category” class.

Default value: false

$walker

(object) (Optional) Walker object to use to build the output. Default is a Walker_Category_Checklist instance.

Default value: null

$checked_ontop

(bool) (Optional) Whether to move checked items out of the hierarchy and to the top of the list.

Default value: true

源码

File: wp-admin/includes/template.php

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
) );
}

腾讯云限时秒杀【点击购买】

搬瓦工,CN2高速线路,1GB带宽,电信联通优化KVM,延迟低,速度快,建站稳定,搬瓦工BandwagonHost VPS优惠码BWH26FXH3HIQ,支持<支付宝> 【点击购买】!

Vultr$3.5日本节点,512M内存/500G流量/1G带宽,电信联通优化,延迟低,速度快【点击购买】!

阿里云香港、新加坡VPS/1核/1G/25G SSD/1T流量/30M带宽/年付¥288【点击购买】

WordPress 开发 wp_category_checklist 将分类显示为checkbox格式

`微信`扫码 加好友

链接到文章: https://www.gkxyz.com/wordpress-kaifa-wp_category_checklist-jiangfenleixianshiweicheckboxgeshi.html

推荐站点

评论已关闭