WordPress: Function Reference/cat is ancestor of:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
无编辑摘要
第1行: 第1行:
== Description ==
== 描述 ==
== 描述 ==


This is a simple function for evaluating if the second category is a child of another category.
这是个简单的函数,用来评价第二个类别是不是另一个类别的子类别。
 
这是个简单的函数,用来第二个类别是不是另一个类别的子类别。
 
== Usage ==


== 用法==
== 用法==


%%% <?php cat_is_ancestor_of(cat1, cat2); ?> %%%
%%% <?php cat_is_ancestor_of(cat1, cat2); ?> %%%
%%% <?php cat_is_ancestor_of(cat1, cat2); ?> %%%
Returns true if cat1 is an ancestor of cat2. Any level of ancestry will return true.


如果cat1是cat2的上一级,返回正确的。任何级别系统都会返回正确的。
如果cat1是cat2的上一级,返回正确的。任何级别系统都会返回正确的。
Arguments should be either integer category IDs or category objects.


参数应该是类别整数ID或者类别objects。
参数应该是类别整数ID或者类别objects。
== Notes ==


== 注意==  
== 注意==  


If arguments are string representations of integers and not true integers '''cat_is_ancestor_of''' will return false.
如果参数是整数的字符串形式而不是真正的整数,'''cat_is_ancestor_of '''会返回错误的。
 
如果参数是整数的字符串形式而不是真正的整数,'''cat_is_ancestor_of'''会返回错误的。
 
 
== Further Reading ==


== 深入阅读 ==
== 深入阅读 ==
* [[WordPress:Function_Reference]]
* [[WordPress:Function_Reference|Function_Reference]]
* [[WordPress:Function_Reference|Function_Reference]]

2008年7月25日 (五) 15:25的版本

描述

这是个简单的函数,用来评价第二个类别是不是另一个类别的子类别。

用法

%%% <?php cat_is_ancestor_of(cat1, cat2); ?> %%%

如果cat1是cat2的上一级,返回正确的。任何级别系统都会返回正确的。

参数应该是类别整数ID或者类别objects。

注意

如果参数是整数的字符串形式而不是真正的整数,cat_is_ancestor_of 会返回错误的。

深入阅读