Lately I'm working on wordpress and I have a design somewhat complicated and can not find a function in wordpress especially to print the categories as follows:
<ul>
<li><a href="">Category 1</a></li>
<li><a href="">Category 2</a></li>
<li><a href="">Category 3</a></li>
<li><a href="">More Categories</a>
<ul>
<li><a href="">Category 4</a></li>
<li><a href="">Category 5</a></li>
<li><a href="">Category 6</a></li>
<li><a href="">Category 7</a></li>
</ul>
</li>
</ul>
This code should work on the list of the wordpress post. Taking the forech of wordpress
foreach((get_the_category()) as $cat) {
echo '<li><a href="'.get_category_link($cat->cat_ID).'">' . $cat->cat_name . '</a><li>';
}
http://codex.wordpress.org/Function_Reference/get_the_category