“Function Reference/wp get object terms”的版本间的差异

来自WordPress中文文档
跳转至: 导航搜索
(.......)
 
(1个修订)
(没有差异)

2009年3月14日 (六) 09:23的版本

Description

Retrieves the terms associated with the given object(s), in the supplied taxonomies.

The following information has to do the tt$args/tt parameter and for what can be contained in the string or array of that parameter, if it exists.

The first argument is called, 'ttorderby/tt' and has the default value of 'ttname/tt'. The other value that is supported is 'ttcount/tt'.

The second argument is called, 'ttorder/tt' and has the default value of 'ttASC/tt'. The only other value that will be acceptable is 'ttDESC/tt'.

The final argument supported is called, 'ttfields/tt' and has the default value of 'ttall/tt'. There are multiple other options that can be used instead. Supported values are as follows: 'ttall/tt', 'ttids/tt', 'ttnames/tt', and finally 'ttall_with_object_id/tt'.

The fields argument also decides what will be returned. If 'ttall/tt' or 'ttall_with_object_id/tt' is choosen or the default kept intact, then all matching terms objects will be returned. If either 'ttids/tt' or 'ttnames/tt' is used, then an array of all matching term ids or term names will be returned respectively.

Usage

%%%?php wp_get_object_terms( $object_ids, $taxonomies, $args ) ?%%%

Parameters

tt$taxonomies/tt
(string#124;array) (required) The taxonomies to retrieve terms from.
Default: Nonenoinclude

div class=template-description style=padding: 0 1.5em; border: 1px solid #eeeeee; background-color: #f9f9f9

Notes

This template is for standardizing how parameters look in the Function Reference and in Template Tags. Here is an example of this template being called: prenowiki检查到模板循环:模板:Parameter/nowiki/pre 检查到模板循环:模板:Parameter

The usage of this template is below: prenowiki检查到模板循环:模板:Parameter/nowiki/pre Let's take a closer look at the parameters..

name
The name of the parameter.
datatype
The datatype that should be given for this parameter when called.
  • string
  • integer
  • boolean
  • mixed
description
A short description of the parameter.
importance
Set this parameter to optional if the parameter is optional. Otherwise, do not declare this parameter—it defaults to required.
  • required
  • optional
default
If this parameter is optional, ttdefault/tt is the value that will be used if the parameter is not declared.

wordpress.org.cn /div /noinclude

tt$args/tt
(array#124;string) (optional) Change what is returned
Default: arraynoinclude

div class=template-description style=padding: 0 1.5em; border: 1px solid #eeeeee; background-color: #f9f9f9

Notes

This template is for standardizing how parameters look in the Function Reference and in Template Tags. Here is an example of this template being called: prenowiki检查到模板循环:模板:Parameter/nowiki/pre 检查到模板循环:模板:Parameter

The usage of this template is below: prenowiki检查到模板循环:模板:Parameter/nowiki/pre Let's take a closer look at the parameters..

name
The name of the parameter.
datatype
The datatype that should be given for this parameter when called.
  • string
  • integer
  • boolean
  • mixed
description
A short description of the parameter.
importance
Set this parameter to optional if the parameter is optional. Otherwise, do not declare this parameter—it defaults to required.
  • required
  • optional
default
If this parameter is optional, ttdefault/tt is the value that will be used if the parameter is not declared.

wordpress.org.cn /div /noinclude

Return Values

(array#124;WP_Error) 
The requested term data or empty array if no terms found. WP_Error if tt$taxonomy/tt does not exist.

Examples

!-- Need creative examples. Feel free to link to external examples. --

Notes

Change Log

Since: 2.3.0

Source File

!-- Need links to current source code files -- ttwp_get_object_terms()/tt is located in ttwp-includes/taxonomy.php/tt.

Related

!--

   To Do:
   Need to find related functions.
   Need to create groups of functions and create templates to add them to a page quickly.
   Some functions may be related to many groups of functions.

--