views:

17

answers:

2

Hi all,

Is it possible to have Wordpress generate this type of unordered list?

<ul id="nav1">
<li><a href="#">item1</a></li>
<li><a href="#">item2</a>
<ul id="nav2">
<li><a href="#">subitem1</a></li>
</ul></li>
<li><a href="#">item3</a></li>
</ul>

Obviously I can do the following:

<ul id="nav1">
<?php wp_list_pages(); ?>
</ul>

But my question is, how do I make it so that I can have a secondary ul under a page (or list item such as 'item2' above)?

Basically, I'm looking for a way for Wordpress to dynamically generate the following:

<li><a href="#">item2</a>
<ul>
<li><a href="#">subitem1</a></li>
</ul></li>

And I can use JQuery if necessary to give the secondary (sub menu) unordered list an id of #nav2...

Anyway, is this possible?

Thanks and I appreciate all of your help!

Amit

A: 

Nevermind guys.

I just tried it with the wp_list_page(); function and it works. It does exactly as I wanted it to with exception to one thing...

It put's an extra <ul> in there so the list looks something like this:

<ul id="nav1">
Pages
<ul>
<li><a href="#">item1</a>
<ul class="children">
<li><a href="#">sub-item1</a></li>
</ul></li>
</ul>
</ul>

Anyone know how to get rid of the <ul> following the Pages title, as well as NOT show the word Pages?

Thanks, Amit

Amit
Finally, the answer is with 'title_li=', that gets rid of the Pages and extra ul tag :)
Amit
A: 

Okay, I solved the added ul program.

This is what I have as the result:

<ul id="nav1"><?php
                $pageargs = array(
                    'link_after'  => '&nbsp;/',
                    'title_li'     => __('')
                    ); 
                wp_list_pages($pageargs); ?></ul>

Hope someone benefits from it :) Amit

Amit