开发者

How to wrap each top most category in <ul> tags?

开发者 https://www.devze.com 2023-01-19 03:18 出处:网络
I need to wrap each top most category intags - wp_list_categories doesn\'t do it开发者_JS百科. How to do it?you just have to define the depth of the list to be printed.

I need to wrap each top most category in tags - wp_list_categories doesn't do it开发者_JS百科. How to do it?


you just have to define the depth of the list to be printed.

These are the possible values u can give for depth.

    * 0 - All Categories and child Categories (Default).
    * -1 - All Categories displayed in flat (no indent) form (overrides hierarchical).
    * 1 - Show only top level Categories
    * n - Value of n (some number) specifies the depth (or level) to descend in displaying Categories

So what you may need will be something like this

<ul>
<?php wp_list_categories('depth=1'); ?>
</ul>

Ofcourse u can add more options...

For wordpress doubts you can always refer the following sites: www.wprecipes.com www.wpbeginner.com wordpresskillertips.blogspot.com

0

精彩评论

暂无评论...
验证码 换一张
取 消