Get_the_category () describes how to obtain a category object that matches the query parameters. & lt ;? Phpget_the_category ($ id )? & Gt; Parameter id (integer) (optional) document number default: $ post-& gt; ID (number of the current article) Example display class
Get_the_category ()
Description
Obtains the category object that matches the query parameter.
Usage
Parameters
Id
(Integer) (Optional) Document No.
Default value: $ post-> ID (number of the current article)
Example
Show category Pictures
cat_name . '" />';}?>
Display the name of the first category
cat_name;?>
Display the connection of the first category
'.$category[0]->cat_name.'';}?>
Obtains the category information of the specified document number.
ID);var_dump($categories);?>
Returned object member
Cat_ID
Category number, stored in the term_id field
Cat_name
Category name, which is stored in the name field
Category_nicename
Alias, stored in slug field
Category_description
Category description, stored in the description field
Category_parent
Parent class number. If no parent class is set to 0, it is stored in the parent field.
Category_count
The quantity used by the category, which is stored in the count field
Source code location
Wp-des/category-template.php