WordPress根据分类ID获取分类链接标签:get_category_link

文 / @WordPress主题

WordPress模板标签get_category_link根据传递的分类ID返回相应分类的固定链接,在WordPress主题开发中也常用到。

get_category_link( integer $category )

函数参数

$category

整数型,默认值:none

必须指定一个分类ID,以返回相应分类的链接

函数使用示例

<?php get_category_link( 6 ); ?>

扩展阅读

get_category_link()函数位于:wp-includes/category-template.php

  • the_category()
  • the_category_rss()
  • single_cat_title()
  • category_description()
  • wp_dropdown_categories()
  • wp_list_categories()
  • get_category_parents()
  • get_the_category()
  • in_category()
添加UTHEME为好友
扫码添加UTHEME微信为好友
· 分享WordPress相关技术文章,主题上新与优惠动态早知道。
· 微信端最大WordPress社群,限时免费入群。