Wordpressget_the_category () function details

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.