wordpress 分类相关

本文介绍了WordPress中的分类系统,包括默认的分类方式如栏目(category)和标签(tags),以及自定义分类(custom taxonomy)的概念。同时,列举了一系列与分类系统相关的函数,帮助开发者更好地管理和使用这些分类。

分类类型,层级

wp中的分类、文章类型(post,page,video,image)、标签、自定义分类、自定义标签都是分类形式。有些分类是有层级关系,有些没有。如图:
一张图搞清楚wordpress的分类

taxonomy分类(category栏目,custom toxonomy自定义分类)表示抽象的分类方式,需要落实到具体的分类项term。举个例子,栏目是抽象分类,而音乐栏目(music)就相对具体,而音乐下面还可以做细分。再如:城市(city)就是一种抽象的分类方式,而上海(shanghai)就相对具体了。

分类系统(分类方法的抽象形式taxonomy),分类项(具体分类方法term)

the_taxonomies

  • is_term()
  • term_exists()
  • get_objects_in_term()
  • get_term()
  • get_term_by()
  • get_term_children()
  • get_term_link()
  • get_terms()
  • get_the_terms()
  • get_the_term_list()
  • has_term()
  • sanitize term()
  • the_terms()
  • get_object_taxonomies()
  • is_object_in_taxonomy()
  • the_taxonomies()
  • wp_get_object_terms()
  • wp_set_object_terms()
  • wp_get_post_terms()
  • wp_set_post_terms()
  • wp_delete_object_term_relationships()
  • wp_remove_object_terms()

默认类别 category,tags

栏目跟标签是默认提供的分类方式。

category 相关函数

  • the_category()
  • the_category_rss()
  • single_cat_title()
  • category_description()
  • wp_dropdown_categories()
  • wp_list_categories()
  • get_the_category()
  • get_the_category_by_ID()
  • get_category_by_slug()
  • get_the_category_list()
  • get_category_parents()
  • get_category_link()
  • is_category()
  • in_category()

tags 相关函数

  • get_tag()
  • get_tag_link()
  • get_tags()
  • get_the_tag_list()
  • get_the_tags()
  • is_tag()
  • the_tags()
  • single_tag_title()
  • tag_description()
  • wp_generate_tag_cloud()
  • wp_tag_cloud()
  • the_taxonomies

显示站点有多少分类

转载于:https://www.cnblogs.com/flowerszhong/p/6195905.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值