WordPress:Function Reference/cat is ancestor of

来自站长百科
Fludlen讨论 | 贡献2008年7月19日 (六) 16:17的版本
跳转至: 导航、​ 搜索

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会返回错误的。


Further Reading

深入阅读