WordPress:Function Reference/cat is ancestor of
来自站长百科
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); ?> %%%
Returns true if cat1 is an ancestor of cat2. Any level of ancestry will return true.
如果cat1是cat2的上一级,返回正确的。任何级别系统都会返回正确的。
Arguments should be either integer category IDs or category 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会返回错误的。