Ok I am trying to create a site with a drop down navigation generated from the WordPress 'wp_list_pages' tag.
I have got to a point now where I am pretty stuck on an element and my raw PHP knowledge is not strong enough to figure it out. I was really hoping I could get some help on the coding of this.
What I am hoping to achieve...
<ul> <li><a href=""><span>Parent Link1</span></a></li> <li><a href=""><span>Parent Link2</span></a></li> <li><a href=""><span>Parent Link3</span></a> <ul> <li><a href="">Child link1</a></li> <li><a href="">Child link2</a></li> <li><a href="">Child link3</a></li> <li class="sub-footer"></li> </ul> </li> </ul>
Notice two main additional features to the standard WordPress generated list, the addition of a span to the parent navigation and the addition of a blank list item on the sub navigation. (This is so I can style a footer to the sub nav)
So, I have managed to get this to a point. I have used a piece of code posted on a different thread to generate the 'spans' I use the following code for this:
<?php $pages = wp_list_pages('echo=0&title_li'); $pages = str_replace('">', '"><span>', $pages); $pages = str_replace('<span><a', '<a', $pages); $pages = str_replace('</a>', '</span></a>', $pages); echo $pages; ?>
The main problem here is it adds a span to the Child sub navigation elements as well. This cannot stay like this due to some IE bugs about keeping elements active when hovering over spans.
And I have been comepletly un-succesful at figuring out how to generate a single li at the bottom of the sub list.
So if anyone can point me in the right direction or throw some code up to help me out it would be much appreciated.